use of com.alibaba.druid.sql.ast.statement.SQLDropIndexStatement in project druid by alibaba.
the class MySqlDropIndexTest method test_0.
public void test_0() throws Exception {
String sql = "drop index index_name on table_name ";
MySqlStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> statementList = parser.parseStatementList();
SQLDropIndexStatement stmt = (SQLDropIndexStatement) statementList.get(0);
// print(statementList);
Assert.assertEquals(1, statementList.size());
MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor();
stmt.accept(visitor);
// System.out.println("Tables : " + visitor.getTables());
// System.out.println("fields : " + visitor.getColumns());
// System.out.println("coditions : " + visitor.getConditions());
// System.out.println("orderBy : " + visitor.getOrderByColumns());
Assert.assertEquals(1, visitor.getTables().size());
Assert.assertEquals(0, visitor.getColumns().size());
Assert.assertEquals(0, visitor.getConditions().size());
Assert.assertTrue(visitor.getTables().containsKey(new TableStat.Name("table_name")));
TableStat tableStat = visitor.getTables().get(new TableStat.Name("table_name"));
Assert.assertEquals(1, tableStat.getDropIndexCount());
}
Aggregations