use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_grants_2.
public void test_show_grants_2() throws Exception {
String sql = "SHOW GRANTS FOR CURRENT_USER";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowGrantsStatement show = (MySqlShowGrantsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW GRANTS FOR CURRENT_USER", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_masterLogs.
public void test_show_masterLogs() throws Exception {
String sql = "SHOW MASTER LOGS ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowMasterLogsStatement show = (MySqlShowMasterLogsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW MASTER LOGS", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_binaryLog_1.
public void test_binaryLog_1() throws Exception {
String sql = "SHOW binlog events from 1 limit 1,2";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowBinLogEventsStatement show = (MySqlShowBinLogEventsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW BINLOG EVENTS FROM 1 LIMIT 1, 2", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_columns.
public void test_show_columns() throws Exception {
String sql = "SHOW full columns from tb1 from db1 like 'var' ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowColumnsStatement show = (MySqlShowColumnsStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW FULL COLUMNS FROM db1.tb1 LIKE 'var'", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_profile_1.
public void test_show_profile_1() throws Exception {
String sql = "SHOW profile all,block io,context switches,cpu,ipc,memory, page faults,source,swaps for query 2 limit 1 offset 2";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProfileStatement show = (MySqlShowProfileStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROFILE ALL, BLOCK IO, CONTEXT SWITCHES, CPU, IPC, MEMORY, PAGE FAULTS, SOURCE, SWAPS FOR QUERY 2 LIMIT 2, 1", output);
}
Aggregations