use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method testSet_3.
public void testSet_3() throws Exception {
String sql = "SET @usrVar1 := ?, @@`var2` =1, @@var3:=?, @'var\\'3'=?";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLSetStatement set = (SQLSetStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET @usrVar1 = ?, @@`var2` = 1, @@var3 = ?, @'var\\'3' = ?", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_databases_2.
public void test_show_databases_2() throws Exception {
String sql = "SHOW DATABASES WHERE `Database` = 'mysql'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowDatabasesStatement show = (MySqlShowDatabasesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW DATABASES WHERE `Database` = 'mysql'", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_status.
public void test_show_status() throws Exception {
String sql = "SHOW STATUS LIKE 'Key%'";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowStatusStatement show = (MySqlShowStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW STATUS LIKE 'Key%'", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_function_status_2.
public void test_show_function_status_2() throws Exception {
String sql = "SHOW function status ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowFunctionStatusStatement show = (MySqlShowFunctionStatusStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FUNCTION STATUS", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_relayLogEvents_1.
public void test_show_relayLogEvents_1() throws Exception {
String sql = "SHOW RELAYLOG EVENTS IN 'x' from 3 limit 5,6";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowRelayLogEventsStatement show = (MySqlShowRelayLogEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW RELAYLOG EVENTS IN 'x' FROM 3 LIMIT 5, 6", output);
}
Aggregations