use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class SQLServerTopTest method test_isEmpty.
public void test_isEmpty() throws Exception {
String sql = "SELECT TOP 10 * FROM T";
SQLServerStatementParser parser = new SQLServerStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
Assert.assertEquals("SELECT TOP 10 *\nFROM T", SQLUtils.toSQLServerString(stmt));
Assert.assertEquals("select top 10 *\nfrom T", SQLUtils.toSQLServerString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION));
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class SQLServerTopTest2 method test_isEmpty.
public void test_isEmpty() throws Exception {
String sql = "SELECT TOP ? * FROM T";
String expect = "SELECT TOP ? *\nFROM T";
SQLServerStatementParser parser = new SQLServerStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputSqlServer(stmt);
Assert.assertEquals(expect, text);
// System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class SqlserverGroupByTest method testGroupBy.
public void testGroupBy() throws Exception {
String sql = "SELECT a.workflowid, COUNT(1) FROM workflow_base a GROUP BY a.workflowid";
SQLStatementParser parser = new SQLServerStatementParser(sql);
//
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatement();
try {
stmt.toString();
} catch (ClassCastException e) {
Assert.fail(e.getMessage());
}
}
Aggregations