SQLStatementParserstatementParser=newSQLStatementParser(DatabaseType.MySQL,shardingRule,parameters,newMySQLParser("DELETE FROM TABLE_XXX",shardingRule,parameters));
SQLParserEnginestatementParser=newSQLParserEngine(DatabaseType.MySQL,newMySQLParser("DELETE FROM TABLE_XXX",shardingRule,parameters),shardingRule,parameters);
"DELETE FROM TABLE_XXX xxx WHERE field4<10 AND TABLE_XXX.field1=1 AND field5>10 AND xxx.field2 IN (1,3) AND field6<=10 AND field3 BETWEEN 5 AND 20 AND field7>=10",
"DELETE FROM TABLE_XXX xxx WHERE field4<10 AND TABLE_XXX.field1=1 AND field5>10 AND xxx.field2 IN (1,3) AND field6<=10 AND field3 BETWEEN 5 AND 20 AND field7>=10",
"DELETE FROM TABLE_XXX xxx WHERE field4<? AND field1=? AND field5>? AND field2 IN (?,?) AND field6<=? AND field3 BETWEEN ? AND ? AND field7>=?",shardingRule,parameters));
"DELETE FROM TABLE_XXX xxx WHERE field4<? AND field1=? AND field5>? AND field2 IN (?,?) AND field6<=? AND field3 BETWEEN ? AND ? AND field7>=?",shardingRule,parameters),
newSQLStatementParser(DatabaseType.MySQL,shardingRule,parameters,newMySQLParser("DELETE FROM TABLE_XXX1, TABLE_xxx2 USING TABLE_XXX1 JOIN TABLE_XXX2",shardingRule,parameters))
newSQLParserEngine(DatabaseType.MySQL,newMySQLParser("DELETE FROM TABLE_XXX1, TABLE_xxx2 USING TABLE_XXX1 JOIN TABLE_XXX2",shardingRule,parameters),shardingRule,parameters)
"INSERT FIRST INTO TABLE_XXX (field1) VALUES (field1) SELECT field1 FROM TABLE_XXX2",shardingRule,parameters),shardingRule,parameters).parseStatement();
SQLStatementParserstatementParser=newSQLStatementParser(DatabaseType.MySQL,shardingRule,parameters,newMySQLParser("UPDATE TABLE_XXX SET field1=field1+1",shardingRule,parameters));
SQLParserEnginestatementParser=newSQLParserEngine(DatabaseType.MySQL,newMySQLParser("UPDATE TABLE_XXX SET field1=field1+1",shardingRule,parameters),shardingRule,parameters);
"UPDATE TABLE_XXX xxx SET TABLE_XXX.field1=field1+1,xxx.field2=2 WHERE "
+"TABLE_XXX.field4<10 AND TABLE_XXX.field1=1 AND xxx.field5>10 AND TABLE_XXX.field2 IN (1,3) AND xxx.field6<=10 AND TABLE_XXX.field3 BETWEEN 5 AND 20 AND xxx.field7>=10",
assertThat(sqlContext.toSqlBuilder().toString(),is("UPDATE [Token(TABLE_XXX)] xxx SET [Token(TABLE_XXX)].field1=field1+1,xxx.field2=2 WHERE [Token(TABLE_XXX)].field4<10 "
...
...
@@ -67,9 +67,9 @@ public final class UpdateStatementParserTest extends AbstractStatementParserTest
"UPDATE TABLE_XXX AS xxx SET field1=field1+? WHERE field4<? AND xxx.field1=? AND field5>? AND xxx.field2 IN (?, ?) AND field6<=? AND xxx.field3 BETWEEN ? AND ? AND field7>=?",
assertThat(sqlContext.toSqlBuilder().toString(),is("UPDATE [Token(TABLE_XXX)] AS xxx SET field1=field1+? "
...
...
@@ -107,8 +107,8 @@ public final class UpdateStatementParserTest extends AbstractStatementParserTest
publicvoidparseWithOr(){
ShardingRuleshardingRule=createShardingRule();
List<Object>parameters=Collections.emptyList();
newSQLStatementParser(DatabaseType.Oracle,shardingRule,parameters,newOracleParser("UPDATE TABLE_XXX SET field1=1 WHERE field1<1 AND (field1 >2 OR field2 =1)",
shardingRule,parameters)).parseStatement();
newSQLParserEngine(DatabaseType.Oracle,newOracleParser("UPDATE TABLE_XXX SET field1=1 WHERE field1<1 AND (field1 >2 OR field2 =1)",