use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class LogicalOperatorsTest method test_4.
public void test_4() throws Exception {
String sql = "SELECT NOT 0;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT NOT 0;", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class LogicalOperatorsTest method test_6.
public void test_6() throws Exception {
String sql = "SELECT ! (1+1);";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT !(1 + 1);", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class LogicalOperatorsTest method test_5.
public void test_5() throws Exception {
String sql = "SELECT NOT NULL;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT NOT NULL;", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class LogicalOperatorsTest method test_2.
public void test_2() throws Exception {
String sql = "SELECT 'string' IS NOT NULL;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT 'string' IS NOT NULL;", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class InsertSyntaxTest method test_6.
public void test_6() throws Exception {
String sql = "INSERT tbl_name (a,b,c) VALUES(1,2,3) ON DUPLICATE KEY UPDATE c=c+1;";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
SQLStatement stmt = stmtList.get(0);
Assert.assertEquals(//
"INSERT INTO tbl_name (a, b, c)" + //
"\nVALUES (1, 2, 3)" + "\nON DUPLICATE KEY UPDATE c = c + 1", SQLUtils.toMySqlString(stmt));
Assert.assertEquals(//
"insert into tbl_name (a, b, c)" + //
"\nvalues (1, 2, 3)" + "\non duplicate key update c = c + 1", SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION));
}
Aggregations