use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class DeleteSyntaxTest method test_2.
public void test_2() throws Exception {
String sql = "DELETE a1, a2 FROM t1 AS a1 INNER JOIN t2 AS a2 WHERE a1.id=a2.id";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
SQLStatement stmt = stmtList.get(0);
Assert.assertEquals(//
"DELETE a1, a2\nFROM t1 a1" + //
"\n\tINNER JOIN t2 a2" + "\nWHERE a1.id = a2.id", SQLUtils.toMySqlString(stmt));
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class MathematicalFunctionsTest method test_22.
public void test_22() throws Exception {
String sql = "SELECT POW(2,-2)";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT POW(2, -2);", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class MathematicalFunctionsTest method test_1.
public void test_1() throws Exception {
String sql = "SELECT ABS(2);";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT ABS(2);", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class MathematicalFunctionsTest method test_14.
public void test_14() throws Exception {
String sql = "SELECT CONV(10+'10'+'10'+0xa,10,10);";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT CONV(10 + '10' + '10' + 0xa, 10, 10);", text);
}
use of com.alibaba.druid.sql.parser.SQLStatementParser in project druid by alibaba.
the class MathematicalFunctionsTest method test_17.
public void test_17() throws Exception {
String sql = "SELECT DEGREES(PI())";
SQLStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
String text = output(stmtList);
Assert.assertEquals("SELECT DEGREES(PI());", text);
}
Aggregations