use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class AssignmentOperatorsTest method test_3.
public void test_3() throws Exception {
String sql = "SELECT @var1:=COUNT(*) FROM t1;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT @var1 := COUNT(*)\nFROM t1;", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class AssignmentOperatorsTest method test_1.
public void test_1() throws Exception {
String sql = "SELECT @var1 := 1, @var2;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT @var1 := 1, @var2;", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class AssignmentOperatorsTest method test_2.
public void test_2() throws Exception {
String sql = "SELECT @var1, @var2 := @var1;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT @var1, @var2 := @var1;", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class AssignmentOperatorsTest method test_4.
public void test_4() throws Exception {
String sql = "UPDATE t1 SET c1 = 2 WHERE c1 = @var1:= 1;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("UPDATE t1\nSET c1 = 2\nWHERE c1 = (@var1 := 1);", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class AssignmentOperatorsTest method test_0.
public void test_0() throws Exception {
String sql = "SELECT @var1, @var2;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT @var1, @var2;", text);
}
Aggregations