diff --git a/pom.xml b/pom.xml index 5e554150ab..364c8e9552 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.alibaba druid - 1.0.6 + 1.0.7 jar druid diff --git a/src/main/java/com/alibaba/druid/VERSION.java b/src/main/java/com/alibaba/druid/VERSION.java index 62685ca2a5..3cb120c9a8 100644 --- a/src/main/java/com/alibaba/druid/VERSION.java +++ b/src/main/java/com/alibaba/druid/VERSION.java @@ -19,7 +19,7 @@ public final class VERSION { public final static int MajorVersion = 1; public final static int MinorVersion = 0; - public final static int RevisionVersion = 6; + public final static int RevisionVersion = 7; public static String getVersionNumber() { return VERSION.MajorVersion + "." + VERSION.MinorVersion + "." + VERSION.RevisionVersion; diff --git a/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java b/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java index 716b21142f..54b889986f 100644 --- a/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java +++ b/src/main/java/com/alibaba/druid/sql/dialect/mysql/parser/MySqlCreateTableParser.java @@ -550,6 +550,10 @@ public MySqlCreateTableStatement parseCrateTable(boolean acceptCreate) { if (lexer.token() == (Token.ON)) { throw new ParserException("TODO"); } + + if (lexer.token() == (Token.AS)) { + lexer.nextToken(); + } if (lexer.token() == (Token.SELECT)) { SQLSelect query = new MySqlSelectParser(this.exprParser).select(); diff --git a/src/main/resources/support/http/resources/js/doT.js b/src/main/resources/support/http/resources/js/doT.js index a82a3ef121..7422b308ae 100644 --- a/src/main/resources/support/http/resources/js/doT.js +++ b/src/main/resources/support/http/resources/js/doT.js @@ -6,7 +6,7 @@ "use strict"; var doT = { - version: '1.0.6', + version: '1.0.7', templateSettings: { evaluate: /\{\{([\s\S]+?\}?)\}\}/g, interpolate: /\{\{=([\s\S]+?)\}\}/g, diff --git a/src/test/java/com/alibaba/druid/bvt/sql/mysql/MySqlCreateTableTest.java b/src/test/java/com/alibaba/druid/bvt/sql/mysql/MySqlCreateTableTest.java index 071c4c8de0..41f5785006 100644 --- a/src/test/java/com/alibaba/druid/bvt/sql/mysql/MySqlCreateTableTest.java +++ b/src/test/java/com/alibaba/druid/bvt/sql/mysql/MySqlCreateTableTest.java @@ -86,4 +86,24 @@ public void test_1() throws Exception { Assert.assertEquals(7, visitor.getColumns().size()); Assert.assertEquals(0, visitor.getConditions().size()); } + + + public void test_2() throws Exception { + String sql = "create table t2 as select * from t1"; + + MySqlStatementParser parser = new MySqlStatementParser(sql); + List statementList = parser.parseStatementList(); + SQLStatement statemen = statementList.get(0); + print(statementList); + + Assert.assertEquals(1, statementList.size()); + + MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor(); + statemen.accept(visitor); + + System.out.println("Tables : " + visitor.getTables()); + System.out.println("fields : " + visitor.getColumns()); + System.out.println("coditions : " + visitor.getConditions()); + System.out.println("orderBy : " + visitor.getOrderByColumns()); + } }