use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_function_status_1.
public void test_show_function_status_1() throws Exception {
String sql = "SHOW function status where 1 = 1";
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 WHERE 1 = 1", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method testdesc_1.
public void testdesc_1() throws Exception {
String sql = "desc db.tb1";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlDescribeStatement desc = parser.parseDescribe();
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(desc);
Assert.assertEquals("DESC db.tb1", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_setNames_1.
public void test_setNames_1() throws Exception {
String sql = "SET NAMEs 'utf8' collatE \"latin1_danish_ci\" ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlSetNamesStatement set = (MySqlSetNamesStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(set);
Assert.assertEquals("SET NAMES utf8 COLLATE latin1_danish_ci", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_grants.
public void test_show_grants() throws Exception {
String sql = "SHOW GRANTS FOR 'root'@'localhost';";
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 'root'@'localhost'", output);
}
use of com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser in project druid by alibaba.
the class DALParserTest method test_show_procedure_code.
public void test_show_procedure_code() throws Exception {
String sql = "SHOW procedure code x";
MySqlStatementParser parser = new MySqlStatementParser(sql);
MySqlShowProcedureCodeStatement show = (MySqlShowProcedureCodeStatement) parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(show);
Assert.assertEquals("SHOW PROCEDURE CODE x", output);
}
Aggregations