package org.opencloudb.parser.druid.impl; import java.sql.SQLNonTransientException; import org.opencloudb.config.model.SchemaConfig; import org.opencloudb.route.RouteResultset; import com.alibaba.druid.sql.ast.SQLStatement; import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement; public class DruidCreateTableParser extends DefaultDruidParser { @Override public void visitorParse(RouteResultset rrs, SQLStatement stmt) { } @Override public void statementParse(SchemaConfig schema, RouteResultset rrs, SQLStatement stmt) throws SQLNonTransientException { MySqlCreateTableStatement createStmt = (MySqlCreateTableStatement)stmt; if(createStmt.getQuery() != null) { String msg = "create table from other table not supported :" + stmt; LOGGER.warn(msg); throw new SQLNonTransientException(msg); } String tableName = removeBackquote(createStmt.getTableSource().toString().toUpperCase()); ctx.addTable(tableName); } }