use of com.alibaba.druid.sql.ast.statement.SQLTableLike in project druid by alibaba.
the class MySqlCreateTableTest160 method test_1.
public void test_1() throws Exception {
// for ADB
String sql = "CREATE TABLE IF NOT EXISTS bar2 (c TIMESTAMP, LIKE bar, d DATE)";
MySqlCreateTableStatement stmt = (MySqlCreateTableStatement) SQLUtils.parseSingleMysqlStatement(sql);
assertTrue(stmt.getTableElementList().get(1) instanceof SQLTableLike);
assertEquals("CREATE TABLE IF NOT EXISTS bar2 (\n" + "\tc TIMESTAMP,\n" + "\tLIKE bar,\n" + "\td DATE\n" + ")", stmt.toString());
}
use of com.alibaba.druid.sql.ast.statement.SQLTableLike in project druid by alibaba.
the class MySqlCreateTable_like_test method test_0.
public void test_0() throws Exception {
String sql = "CREATE TABLE like_test (LIKE t1)";
List<SQLStatement> statementList = SQLUtils.parseStatements(sql, JdbcConstants.MYSQL, true);
assertEquals(1, statementList.size());
MySqlCreateTableStatement stmt = (MySqlCreateTableStatement) statementList.get(0);
SQLExprTableSource like = stmt.getLike();
assertTrue(stmt.getTableElementList().size() == 1);
assertTrue(like == null);
assertTrue(stmt.getTableElementList().get(0) instanceof SQLTableLike);
assertEquals("CREATE TABLE like_test (\n" + "\tLIKE t1\n" + ")", stmt.toString());
}
use of com.alibaba.druid.sql.ast.statement.SQLTableLike in project druid by alibaba.
the class MySqlCreateTableTest160 method test_0.
public void test_0() throws Exception {
// for ADB
String sql = "CREATE TABLE IF NOT EXISTS bar (LIKE a INCLUDING PROPERTIES)";
MySqlCreateTableStatement stmt = (MySqlCreateTableStatement) SQLUtils.parseSingleMysqlStatement(sql);
assertTrue(stmt.getTableElementList().get(0) instanceof SQLTableLike);
assertEquals("CREATE TABLE IF NOT EXISTS bar (\n" + "\tLIKE a INCLUDING PROPERTIES\n" + ")", stmt.toString());
}
Aggregations