diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/dialect/mysql/MySQLKeyword.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/dialect/mysql/MySQLKeyword.java
index 20d8fe83eee82b1d02cd17e035f2714269386bbc..f9adb59aabdb14863746493661b1d98587851109 100755
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/dialect/mysql/MySQLKeyword.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/dialect/mysql/MySQLKeyword.java
@@ -53,5 +53,6 @@ public enum MySQLKeyword implements Keyword {
OPTIMIZE,
ANALYZE,
IGNORE,
- IDENTIFIED
+ IDENTIFIED,
+ MODIFY
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/dialect/sqlserver/SQLServerKeyword.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/dialect/sqlserver/SQLServerKeyword.java
index 31da960968431396970989f82484e76ded3ddda2..6a295b0a7b9c6a74f3622e072324186f274d6051 100755
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/dialect/sqlserver/SQLServerKeyword.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/dialect/sqlserver/SQLServerKeyword.java
@@ -33,7 +33,6 @@ public enum SQLServerKeyword implements Keyword {
ROW_NUMBER,
PARTITION,
ONLY,
- IF,
OUTPUT,
AUTO,
BEGIN,
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/token/DefaultKeyword.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/token/DefaultKeyword.java
index 69e4fb780142e7526588d513fa07de120ee7c8c4..5779dd71aea2a831182143f012daaa2e3cb1a633 100755
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/token/DefaultKeyword.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/lexer/token/DefaultKeyword.java
@@ -49,14 +49,15 @@ public enum DefaultKeyword implements Keyword {
ASC,
DESC,
GROUP,
- BY,
- HAVING,
- INTO,
- VALUES,
- COLUMN,
- TABLE,
- TABLESPACE,
- SET,
+ BY,
+ HAVING,
+ INTO,
+ VALUES,
+ COLUMN,
+ TABLE,
+ TABLESPACE,
+ SET,
+ ADD,
PRIMARY,
KEY,
INDEX,
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLAlterParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLAlterParser.java
index 9df277a6306ecdc1c48470fce24783ad48755046..57f9c47777550e899b8939dd63f8f41f3e5e0f93 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLAlterParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLAlterParser.java
@@ -17,7 +17,6 @@
package com.dangdang.ddframe.rdb.sharding.parsing.parser.dialect.mysql;
-import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.alter.AbstractAlterParser;
@@ -31,9 +30,4 @@ public final class MySQLAlterParser extends AbstractAlterParser {
public MySQLAlterParser(final AbstractSQLParser sqlParser) {
super(sqlParser);
}
-
- @Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
- return new Keyword[] {};
- }
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLCreateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLCreateParser.java
index bdde89bcea68fa24365fc5d84cfe2a195b3bef30..d25ba97776b4d15948a142adbb825bcd7739e311 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLCreateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLCreateParser.java
@@ -34,12 +34,12 @@ public final class MySQLCreateParser extends AbstractCreateParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenCreateAndKeyword() {
+ protected Keyword[] getSkippedKeywordsBetweenCreateAndKeyword() {
return new Keyword[] {DefaultKeyword.TEMPORARY};
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
+ protected Keyword[] getSkippedKeywordsBetweenCreateTableAndTableName() {
return new Keyword[] {DefaultKeyword.IF, DefaultKeyword.NOT, DefaultKeyword.EXISTS};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLDropParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLDropParser.java
index 92a665bf9f57d55863b86185e38c60ad813f0c8b..faf5153b44259fe166334d8733b372bf66d064dd 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLDropParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLDropParser.java
@@ -17,6 +17,7 @@
package com.dangdang.ddframe.rdb.sharding.parsing.parser.dialect.mysql;
+import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.DefaultKeyword;
import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.drop.AbstractDropParser;
@@ -33,7 +34,12 @@ public final class MySQLDropParser extends AbstractDropParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
- return new Keyword[] {};
+ protected Keyword[] getSkippedKeywordsBetweenDropAndTable() {
+ return new Keyword[] {DefaultKeyword.TEMPORARY};
+ }
+
+ @Override
+ protected Keyword[] getSkippedKeywordsBetweenDropTableAndTableName() {
+ return new Keyword[] {DefaultKeyword.IF, DefaultKeyword.EXISTS};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLTruncateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLTruncateParser.java
index 64a71306ab9066423fb9da61b30c1d2b4f75ab79..3852e145018cef3e99acb021326a72d059c21516 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLTruncateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/mysql/MySQLTruncateParser.java
@@ -17,7 +17,6 @@
package com.dangdang.ddframe.rdb.sharding.parsing.parser.dialect.mysql;
-import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.truncate.AbstractTruncateParser;
@@ -31,9 +30,4 @@ public final class MySQLTruncateParser extends AbstractTruncateParser {
public MySQLTruncateParser(final AbstractSQLParser sqlParser) {
super(sqlParser);
}
-
- @Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
- return new Keyword[] {};
- }
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleAlterParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleAlterParser.java
index e7fe66f5d468ef78b7c657e4921c156d2071a192..0c6b2b328c1af083d0711dee33c631d7dee525a6 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleAlterParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleAlterParser.java
@@ -17,7 +17,6 @@
package com.dangdang.ddframe.rdb.sharding.parsing.parser.dialect.oracle;
-import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.alter.AbstractAlterParser;
@@ -31,9 +30,4 @@ public final class OracleAlterParser extends AbstractAlterParser {
public OracleAlterParser(final AbstractSQLParser sqlParser) {
super(sqlParser);
}
-
- @Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
- return new Keyword[] {};
- }
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleCreateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleCreateParser.java
index 1a3c8e1f3598156fdf81f081270fb0982ce9c226..ead7dafbd9b46d43fbc4bfc0840f1263eed386a2 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleCreateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleCreateParser.java
@@ -34,12 +34,12 @@ public final class OracleCreateParser extends AbstractCreateParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenCreateAndKeyword() {
+ protected Keyword[] getSkippedKeywordsBetweenCreateAndKeyword() {
return new Keyword[] {DefaultKeyword.GLOBAL, DefaultKeyword.TEMPORARY};
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
+ protected Keyword[] getSkippedKeywordsBetweenCreateTableAndTableName() {
return new Keyword[] {};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleDropParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleDropParser.java
index b810e6fe35cb57ef0634c9e4918f5a4c9e510a63..eb086919024ec83cbf20d29df8a4397a2d3a5787 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleDropParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleDropParser.java
@@ -33,7 +33,7 @@ public final class OracleDropParser extends AbstractDropParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
+ protected Keyword[] getSkippedKeywordsBetweenDropTableAndTableName() {
return new Keyword[] {};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleTruncateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleTruncateParser.java
index b6e9e1e37e4c3c22175b07a683276b86d990f418..39017be9d3461e910c619e95c31138e2ecd3da82 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleTruncateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/oracle/OracleTruncateParser.java
@@ -17,7 +17,6 @@
package com.dangdang.ddframe.rdb.sharding.parsing.parser.dialect.oracle;
-import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.truncate.AbstractTruncateParser;
@@ -31,9 +30,4 @@ public final class OracleTruncateParser extends AbstractTruncateParser {
public OracleTruncateParser(final AbstractSQLParser sqlParser) {
super(sqlParser);
}
-
- @Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
- return new Keyword[] {};
- }
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLAlterParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLAlterParser.java
index cc38dc74fb4c444a3012f571716fb9cbc0c1d616..ff2c1fd0870b3c5238ca9a55c97e26ef23e6b935 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLAlterParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLAlterParser.java
@@ -17,6 +17,7 @@
package com.dangdang.ddframe.rdb.sharding.parsing.parser.dialect.postgresql;
+import com.dangdang.ddframe.rdb.sharding.parsing.lexer.dialect.postgresql.PostgreSQLKeyword;
import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.DefaultKeyword;
import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
@@ -34,7 +35,7 @@ public final class PostgreSQLAlterParser extends AbstractAlterParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
- return new Keyword[] {DefaultKeyword.IF, DefaultKeyword.NOT, DefaultKeyword.EXISTS};
+ protected Keyword[] getSkippedKeywordsBetweenAlterTableAndTableName() {
+ return new Keyword[] {DefaultKeyword.IF, DefaultKeyword.EXISTS, PostgreSQLKeyword.ONLY};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLCreateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLCreateParser.java
index c95c3f992d654e7903a67907a9af3ae27deaee0c..36d0a9dd299ac4a8d8ab313c8731c94ecce930a4 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLCreateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLCreateParser.java
@@ -35,12 +35,12 @@ public final class PostgreSQLCreateParser extends AbstractCreateParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenCreateAndKeyword() {
+ protected Keyword[] getSkippedKeywordsBetweenCreateAndKeyword() {
return new Keyword[] {DefaultKeyword.GLOBAL, DefaultKeyword.LOCAL, DefaultKeyword.TEMPORARY, PostgreSQLKeyword.TEMP, PostgreSQLKeyword.UNLOGGED};
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
+ protected Keyword[] getSkippedKeywordsBetweenCreateTableAndTableName() {
return new Keyword[] {DefaultKeyword.IF, DefaultKeyword.NOT, DefaultKeyword.EXISTS};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLDropParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLDropParser.java
index c3376d31ff9eb9c455497277f3fdcd3e5fc5812a..1cf8170d28f74da1afedef78fedc087acc4d4393 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLDropParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLDropParser.java
@@ -34,7 +34,7 @@ public final class PostgreSQLDropParser extends AbstractDropParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
+ protected Keyword[] getSkippedKeywordsBetweenDropTableAndTableName() {
return new Keyword[] {DefaultKeyword.IF, DefaultKeyword.EXISTS};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLTruncateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLTruncateParser.java
index 701a6bc002bcd1b37d5be2cea82ad4346fe8a925..46f3cf27c5c2e0adbb07dda4641b511b66967905 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLTruncateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/postgresql/PostgreSQLTruncateParser.java
@@ -34,7 +34,7 @@ public final class PostgreSQLTruncateParser extends AbstractTruncateParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
+ protected Keyword[] getSkippedKeywordsBetweenTruncateTableAndTableName() {
return new Keyword[] {PostgreSQLKeyword.ONLY};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerAlterParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerAlterParser.java
index d16fe524410f2705bda80c04bb8afe95af889d15..cb86a76a0aa288948d17cb95235dfe89159e5799 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerAlterParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerAlterParser.java
@@ -17,7 +17,6 @@
package com.dangdang.ddframe.rdb.sharding.parsing.parser.dialect.sqlserver;
-import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.alter.AbstractAlterParser;
@@ -31,9 +30,4 @@ public final class SQLServerAlterParser extends AbstractAlterParser {
public SQLServerAlterParser(final AbstractSQLParser sqlParser) {
super(sqlParser);
}
-
- @Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
- return new Keyword[] {};
- }
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerCreateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerCreateParser.java
index 4a018c9eca3e598ff8f6356e78e466f234a15d0b..45254c393e06c590cfa7f9782827f34a77bb8497 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerCreateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerCreateParser.java
@@ -33,12 +33,12 @@ public final class SQLServerCreateParser extends AbstractCreateParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenCreateAndKeyword() {
+ protected Keyword[] getSkippedKeywordsBetweenCreateAndKeyword() {
return new Keyword[] {};
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
+ protected Keyword[] getSkippedKeywordsBetweenCreateTableAndTableName() {
return new Keyword[] {};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerDropParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerDropParser.java
index c956c8f55d2d2202b84f4f5b7a605b5e21a7a90d..dcebfcf77ce233b9d2218fd256c3018c585435b4 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerDropParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerDropParser.java
@@ -34,7 +34,7 @@ public final class SQLServerDropParser extends AbstractDropParser {
}
@Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
+ protected Keyword[] getSkippedKeywordsBetweenDropTableAndTableName() {
return new Keyword[] {DefaultKeyword.IF, DefaultKeyword.EXISTS};
}
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerTruncateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerTruncateParser.java
index db222d8269723f68ab9f40af94c68b961774374f..7ba8c3dd91cebe614ff49a2c749121a032df24d3 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerTruncateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/dialect/sqlserver/SQLServerTruncateParser.java
@@ -17,7 +17,6 @@
package com.dangdang.ddframe.rdb.sharding.parsing.parser.dialect.sqlserver;
-import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.truncate.AbstractTruncateParser;
@@ -31,9 +30,4 @@ public final class SQLServerTruncateParser extends AbstractTruncateParser {
public SQLServerTruncateParser(final AbstractSQLParser sqlParser) {
super(sqlParser);
}
-
- @Override
- protected Keyword[] getSkipWordsBetweenKeywordAndTableName() {
- return new Keyword[] {};
- }
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/alter/AbstractAlterParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/alter/AbstractAlterParser.java
index 24944898dc91a21760322cdb74a8cd0882f44a63..2c5da3cf79196daa610f2f42ca38a449792f5b87 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/alter/AbstractAlterParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/alter/AbstractAlterParser.java
@@ -51,10 +51,12 @@ public abstract class AbstractAlterParser implements SQLStatementParser {
if (!sqlParser.skipIfEqual(DefaultKeyword.TABLE)) {
throw new SQLParsingUnsupportedException(sqlParser.getLexer().getCurrentToken().getType());
}
- getSqlParser().skipAll(getSkipWordsBetweenKeywordAndTableName());
+ getSqlParser().skipAll(getSkippedKeywordsBetweenAlterTableAndTableName());
sqlParser.parseSingleTable(alterStatement);
return alterStatement;
}
- protected abstract Keyword[] getSkipWordsBetweenKeywordAndTableName();
+ protected Keyword[] getSkippedKeywordsBetweenAlterTableAndTableName() {
+ return new Keyword[0];
+ }
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/create/AbstractCreateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/create/AbstractCreateParser.java
index 3b8475fb71d777ba865fbf4a717f2ec3307513fc..76193ef7954201836b9962b1fa944ce64c4c307b 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/create/AbstractCreateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/create/AbstractCreateParser.java
@@ -48,16 +48,16 @@ public abstract class AbstractCreateParser implements SQLStatementParser {
@Override
public DDLStatement parse() {
sqlParser.getLexer().nextToken();
- getSqlParser().skipAll(getSkipWordsBetweenCreateAndKeyword());
+ getSqlParser().skipAll(getSkippedKeywordsBetweenCreateAndKeyword());
if (!sqlParser.skipIfEqual(DefaultKeyword.TABLE)) {
throw new SQLParsingUnsupportedException(sqlParser.getLexer().getCurrentToken().getType());
}
- getSqlParser().skipAll(getSkipWordsBetweenKeywordAndTableName());
+ getSqlParser().skipAll(getSkippedKeywordsBetweenCreateTableAndTableName());
sqlParser.parseSingleTable(createStatement);
return createStatement;
}
- protected abstract Keyword[] getSkipWordsBetweenCreateAndKeyword();
+ protected abstract Keyword[] getSkippedKeywordsBetweenCreateAndKeyword();
- protected abstract Keyword[] getSkipWordsBetweenKeywordAndTableName();
+ protected abstract Keyword[] getSkippedKeywordsBetweenCreateTableAndTableName();
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/drop/AbstractDropParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/drop/AbstractDropParser.java
index a1e2154331638afc65a403f5546c3a93242a2682..5b6a73bd8f275e2084d5fcb72aa328d769c05130 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/drop/AbstractDropParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/drop/AbstractDropParser.java
@@ -48,13 +48,18 @@ public abstract class AbstractDropParser implements SQLStatementParser {
@Override
public DDLStatement parse() {
sqlParser.getLexer().nextToken();
+ getSqlParser().skipAll(getSkippedKeywordsBetweenDropAndTable());
if (!sqlParser.skipIfEqual(DefaultKeyword.TABLE)) {
throw new SQLParsingUnsupportedException(sqlParser.getLexer().getCurrentToken().getType());
}
- getSqlParser().skipAll(getSkipWordsBetweenKeywordAndTableName());
+ getSqlParser().skipAll(getSkippedKeywordsBetweenDropTableAndTableName());
sqlParser.parseSingleTable(dropStatement);
return dropStatement;
}
- protected abstract Keyword[] getSkipWordsBetweenKeywordAndTableName();
+ protected Keyword[] getSkippedKeywordsBetweenDropAndTable() {
+ return new Keyword[0];
+ }
+
+ protected abstract Keyword[] getSkippedKeywordsBetweenDropTableAndTableName();
}
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/truncate/AbstractTruncateParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/truncate/AbstractTruncateParser.java
index 48d8b14f1d7fad39dd7080c964f4846da5332611..d73a66e8d934dd2b890f9106d3fc1d11d3d68962 100644
--- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/truncate/AbstractTruncateParser.java
+++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/statement/ddl/truncate/AbstractTruncateParser.java
@@ -20,7 +20,6 @@ package com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.truncate;
import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.DefaultKeyword;
import com.dangdang.ddframe.rdb.sharding.parsing.lexer.token.Keyword;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.AbstractSQLParser;
-import com.dangdang.ddframe.rdb.sharding.parsing.parser.exception.SQLParsingUnsupportedException;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.SQLStatementParser;
import com.dangdang.ddframe.rdb.sharding.parsing.parser.statement.ddl.DDLStatement;
import lombok.AccessLevel;
@@ -48,13 +47,13 @@ public abstract class AbstractTruncateParser implements SQLStatementParser {
@Override
public DDLStatement parse() {
sqlParser.getLexer().nextToken();
- if (!sqlParser.skipIfEqual(DefaultKeyword.TABLE)) {
- throw new SQLParsingUnsupportedException(sqlParser.getLexer().getCurrentToken().getType());
- }
- getSqlParser().skipAll(getSkipWordsBetweenKeywordAndTableName());
+ sqlParser.skipIfEqual(DefaultKeyword.TABLE);
+ getSqlParser().skipAll(getSkippedKeywordsBetweenTruncateTableAndTableName());
sqlParser.parseSingleTable(truncateStatement);
return truncateStatement;
}
- protected abstract Keyword[] getSkipWordsBetweenKeywordAndTableName();
+ protected Keyword[] getSkippedKeywordsBetweenTruncateTableAndTableName() {
+ return new Keyword[0];
+ }
}
diff --git a/sharding-jdbc-core/src/test/resources/parser/alter.xml b/sharding-jdbc-core/src/test/resources/parser/alter.xml
new file mode 100644
index 0000000000000000000000000000000000000000..71e27a16a01dd999171004b74036eb6a0b009869
--- /dev/null
+++ b/sharding-jdbc-core/src/test/resources/parser/alter.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sharding-jdbc-core/src/test/resources/parser/create.xml b/sharding-jdbc-core/src/test/resources/parser/create.xml
index d51b77716317928e32070b175531588fe3e57fc7..e822d3643341346c089f92af632659cbbdd3543c 100644
--- a/sharding-jdbc-core/src/test/resources/parser/create.xml
+++ b/sharding-jdbc-core/src/test/resources/parser/create.xml
@@ -15,4 +15,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sharding-jdbc-core/src/test/resources/parser/drop.xml b/sharding-jdbc-core/src/test/resources/parser/drop.xml
new file mode 100644
index 0000000000000000000000000000000000000000..58193bb01d930435e1471eec665f169a85dca458
--- /dev/null
+++ b/sharding-jdbc-core/src/test/resources/parser/drop.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sharding-jdbc-core/src/test/resources/parser/truncate.xml b/sharding-jdbc-core/src/test/resources/parser/truncate.xml
new file mode 100644
index 0000000000000000000000000000000000000000..11d39c0ea2498ce1911de81c6f62b363cbd2467a
--- /dev/null
+++ b/sharding-jdbc-core/src/test/resources/parser/truncate.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sharding-jdbc-core/src/test/resources/sql/ddl/alter.xml b/sharding-jdbc-core/src/test/resources/sql/ddl/alter.xml
new file mode 100644
index 0000000000000000000000000000000000000000..232c4ad71f2ff42fa38a29eaf365fe5dbf82b043
--- /dev/null
+++ b/sharding-jdbc-core/src/test/resources/sql/ddl/alter.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/sharding-jdbc-core/src/test/resources/sql/ddl/create.xml b/sharding-jdbc-core/src/test/resources/sql/ddl/create.xml
index c2a9a5650e1391f2ebf63fd2d637e5f7d6d9393e..8900753f62a04aaebc187d44a9ad55153cfd2972 100644
--- a/sharding-jdbc-core/src/test/resources/sql/ddl/create.xml
+++ b/sharding-jdbc-core/src/test/resources/sql/ddl/create.xml
@@ -1,6 +1,9 @@
-
-
+
+
+
+
+
diff --git a/sharding-jdbc-core/src/test/resources/sql/ddl/drop.xml b/sharding-jdbc-core/src/test/resources/sql/ddl/drop.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e112882965b6486f2e0ffcd1d84d31a05a7c49a6
--- /dev/null
+++ b/sharding-jdbc-core/src/test/resources/sql/ddl/drop.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/sharding-jdbc-core/src/test/resources/sql/ddl/truncate.xml b/sharding-jdbc-core/src/test/resources/sql/ddl/truncate.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c3d82e3aa7e4c26a6869aad62b8eb28567c21624
--- /dev/null
+++ b/sharding-jdbc-core/src/test/resources/sql/ddl/truncate.xml
@@ -0,0 +1,5 @@
+
+
+
+
+