use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class MySqlStatementParser method parsePrepare.
public MySqlPrepareStatement parsePrepare() {
acceptIdentifier("PREPARE");
SQLName name = exprParser.name();
accept(Token.FROM);
SQLExpr from = exprParser.expr();
return new MySqlPrepareStatement(name, from);
}
use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class MySqlStatementParser method parseExecute.
public MySqlExecuteStatement parseExecute() {
acceptIdentifier("EXECUTE");
MySqlExecuteStatement stmt = new MySqlExecuteStatement();
SQLName statementName = exprParser.name();
stmt.setStatementName(statementName);
if (identifierEquals("USING")) {
lexer.nextToken();
exprParser.exprList(stmt.getParameters(), stmt);
}
return stmt;
}
use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class MySqlSchemaStatVisitor method visit.
@Override
public boolean visit(MySqlDeclareStatement x) {
for (SQLDeclareItem item : x.getVarList()) {
item.setParent(x);
SQLName var = (SQLName) item.getName();
this.variants.put(var.toString(), var);
}
return false;
}
use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class MySqlStatementParser method parseReplicate.
public MySqlReplaceStatement parseReplicate() {
MySqlReplaceStatement stmt = new MySqlReplaceStatement();
accept(Token.REPLACE);
if (lexer.token() == Token.COMMENT) {
lexer.nextToken();
}
if (identifierEquals(LOW_PRIORITY)) {
stmt.setLowPriority(true);
lexer.nextToken();
}
if (identifierEquals(DELAYED)) {
stmt.setDelayed(true);
lexer.nextToken();
}
if (lexer.token() == Token.INTO) {
lexer.nextToken();
}
SQLName tableName = exprParser.name();
stmt.setTableName(tableName);
if (lexer.token() == Token.LPAREN) {
lexer.nextToken();
if (lexer.token() == Token.SELECT) {
SQLQueryExpr queryExpr = (SQLQueryExpr) this.exprParser.expr();
stmt.setQuery(queryExpr);
} else {
this.exprParser.exprList(stmt.getColumns(), stmt);
}
accept(Token.RPAREN);
}
if (lexer.token() == Token.VALUES || identifierEquals("VALUE")) {
lexer.nextToken();
parseValueClause(stmt.getValuesList(), 0);
} else if (lexer.token() == Token.SELECT) {
SQLQueryExpr queryExpr = (SQLQueryExpr) this.exprParser.expr();
stmt.setQuery(queryExpr);
} else if (lexer.token() == Token.SET) {
lexer.nextToken();
SQLInsertStatement.ValuesClause values = new SQLInsertStatement.ValuesClause();
stmt.getValuesList().add(values);
for (; ; ) {
stmt.addColumn(this.exprParser.name());
if (lexer.token() == Token.COLONEQ) {
lexer.nextToken();
} else {
accept(Token.EQ);
}
values.addValue(this.exprParser.expr());
if (lexer.token() == (Token.COMMA)) {
lexer.nextToken();
continue;
}
break;
}
} else if (lexer.token() == Token.LPAREN) {
lexer.nextToken();
SQLQueryExpr queryExpr = (SQLQueryExpr) this.exprParser.expr();
stmt.setQuery(queryExpr);
accept(Token.RPAREN);
}
return stmt;
}
use of com.alibaba.druid.sql.ast.SQLName in project druid by alibaba.
the class OracleCreateTableParser method parseSubPartition.
protected SQLSubPartition parseSubPartition() {
acceptIdentifier("SUBPARTITION");
SQLSubPartition subPartition = new SQLSubPartition();
SQLName name = this.exprParser.name();
subPartition.setName(name);
SQLPartitionValue values = this.exprParser.parsePartitionValues();
if (values != null) {
subPartition.setValues(values);
}
return subPartition;
}
Aggregations