use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class SQLStatementParser method parseDropProcedure.
protected SQLDropProcedureStatement parseDropProcedure(boolean acceptDrop) {
if (acceptDrop) {
accept(Token.DROP);
}
SQLDropProcedureStatement stmt = new SQLDropProcedureStatement(getDbType());
accept(Token.PROCEDURE);
if (lexer.token() == Token.IF) {
lexer.nextToken();
accept(Token.EXISTS);
stmt.setIfExists(true);
}
SQLName name = this.exprParser.name();
stmt.setName(name);
return stmt;
}
use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class SQLStatementParser method parseDropView.
protected SQLDropViewStatement parseDropView(boolean acceptDrop) {
if (acceptDrop) {
accept(Token.DROP);
}
SQLDropViewStatement stmt = new SQLDropViewStatement(getDbType());
accept(Token.VIEW);
if (lexer.token() == Token.IF) {
lexer.nextToken();
accept(Token.EXISTS);
stmt.setIfExists(true);
}
for (; ; ) {
SQLName name = this.exprParser.name();
stmt.addPartition(new SQLExprTableSource(name));
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
if (identifierEquals("RESTRICT")) {
lexer.nextToken();
stmt.setRestrict(true);
} else if (identifierEquals("CASCADE")) {
lexer.nextToken();
if (identifierEquals("CONSTRAINTS")) {
// for oracle
lexer.nextToken();
}
stmt.setCascade(true);
}
return stmt;
}
use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class SQLStatementParser method parseDropSequece.
protected SQLDropSequenceStatement parseDropSequece(boolean acceptDrop) {
if (acceptDrop) {
accept(Token.DROP);
}
lexer.nextToken();
SQLName name = this.exprParser.name();
SQLDropSequenceStatement stmt = new SQLDropSequenceStatement(getDbType());
stmt.setName(name);
return stmt;
}
use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class SchemaStatVisitor method visit.
@Override
public boolean visit(SQLDropIndexStatement x) {
setMode(x, Mode.DropIndex);
SQLExprTableSource table = x.getTableName();
if (table != null) {
SQLName name = (SQLName) table.getExpr();
String ident = name.toString();
setCurrentTable(ident);
TableStat stat = getTableStat(ident);
stat.incrementDropIndexCount();
Map<String, String> aliasMap = getAliasMap();
putAliasMap(aliasMap, ident, ident);
}
return false;
}
use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class SchemaStatVisitor method visit.
@Override
public boolean visit(SQLForeignKeyImpl x) {
for (SQLName column : x.getReferencingColumns()) {
column.accept(this);
}
String table = x.getReferencedTableName().getSimpleName();
setCurrentTable(table);
TableStat stat = getTableStat(table);
stat.incrementReferencedCount();
for (SQLName column : x.getReferencedColumns()) {
String columnName = column.getSimpleName();
addColumn(table, columnName);
}
return false;
}
Aggregations