use of io.shardingjdbc.core.parsing.SQLParsingEngine in project sharding-jdbc by shardingjdbc.
the class InsertStatementParserTest method assertParseWithoutParameter.
@Test
public void assertParseWithoutParameter() {
ShardingRule shardingRule = createShardingRule();
SQLParsingEngine statementParser = new SQLParsingEngine(DatabaseType.MySQL, "INSERT INTO `TABLE_XXX` (`field1`, `field2`) VALUES (10, 1)", shardingRule);
InsertStatement insertStatement = (InsertStatement) statementParser.parse();
assertInsertStatementWithoutParameter(insertStatement);
}
use of io.shardingjdbc.core.parsing.SQLParsingEngine in project sharding-jdbc by shardingjdbc.
the class InsertStatementParserTest method assertParseWithParameter.
@Test
public void assertParseWithParameter() {
ShardingRule shardingRule = createShardingRule();
SQLParsingEngine statementParser = new SQLParsingEngine(DatabaseType.MySQL, "INSERT INTO TABLE_XXX (field1, field2) VALUES (?, ?)", shardingRule);
InsertStatement insertStatement = (InsertStatement) statementParser.parse();
assertInsertStatementWithParameter(insertStatement);
}
use of io.shardingjdbc.core.parsing.SQLParsingEngine in project sharding-jdbc by shardingjdbc.
the class InsertStatementParserTest method assertParseWithGenerateKeyColumnsWithParameter.
@Test
public void assertParseWithGenerateKeyColumnsWithParameter() {
ShardingRule shardingRule = createShardingRuleWithGenerateKeyColumns();
SQLParsingEngine statementParser = new SQLParsingEngine(DatabaseType.MySQL, "INSERT INTO `TABLE_XXX` (`field1`) VALUES (?)", shardingRule);
InsertStatement insertStatement = (InsertStatement) statementParser.parse();
assertInsertStatementWithParameter(insertStatement);
}
use of io.shardingjdbc.core.parsing.SQLParsingEngine in project sharding-jdbc by shardingjdbc.
the class UpdateStatementParserTest method parseWithoutParameter.
@Test
public void parseWithoutParameter() {
ShardingRule shardingRule = createShardingRule();
SQLParsingEngine statementParser = new SQLParsingEngine(DatabaseType.MySQL, "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", shardingRule);
DMLStatement updateStatement = (DMLStatement) statementParser.parse();
assertUpdateStatementWithoutParameter(updateStatement);
}
use of io.shardingjdbc.core.parsing.SQLParsingEngine in project sharding-jdbc by shardingjdbc.
the class UpdateStatementParserTest method parseWithParameter.
@Test
public void parseWithParameter() {
String sql = "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>=?";
ShardingRule shardingRule = createShardingRule();
SQLParsingEngine statementParser = new SQLParsingEngine(DatabaseType.MySQL, sql, shardingRule);
DMLStatement updateStatement = (DMLStatement) statementParser.parse();
assertUpdateStatementWitParameter(updateStatement);
}
Aggregations