use of com.alibaba.druid.sql.ast.statement.SQLCallStatement in project dble by actiontech.
the class AbstractRouteStrategy method parseProcedureForCall.
private void parseProcedureForCall(Procedure procedure, String query, SQLCallStatement statement) {
SQLCallStatement sqlCallStatement = statement;
procedure.setName(sqlCallStatement.getProcedureName().getSimpleName());
List<SQLExpr> parameterList = sqlCallStatement.getParameters();
for (int i1 = 0; i1 < parameterList.size(); i1++) {
SQLExpr sqlExpr = parameterList.get(i1);
String pName = sqlExpr.toString();
ProcedureParameter parameter = new ProcedureParameter();
parameter.setIndex(i1 + 1);
parameter.setName(pName);
parameter.setParameterType(ProcedureParameter.IN);
if (pName.startsWith("@")) {
procedure.getParameterMap().put(pName, parameter);
} else {
procedure.getParameterMap().put(String.valueOf(i1 + 1), parameter);
}
}
procedure.setCallSql(query);
}
use of com.alibaba.druid.sql.ast.statement.SQLCallStatement in project dble by actiontech.
the class AbstractRouteStrategy method parseProcedure.
private Procedure parseProcedure(String sql) {
Procedure procedure = new Procedure();
procedure.setOriginSql(sql);
procedure.setResultList(false);
SQLStatementParser parser = new MySqlStatementParser(sql);
SQLStatement statement = parser.parseStatement();
if (statement instanceof SQLCallStatement) {
parseProcedureForCall(procedure, sql, (SQLCallStatement) statement);
}
return procedure;
}
use of com.alibaba.druid.sql.ast.statement.SQLCallStatement in project druid by alibaba.
the class SQLASTVisitorAdapterTest method test_adapter.
public void test_adapter() throws Exception {
SQLASTVisitorAdapter adapter = new SQLASTVisitorAdapter();
new SQLBinaryOpExpr().accept(adapter);
new SQLInListExpr().accept(adapter);
new SQLSelectQueryBlock().accept(adapter);
new SQLDropTableStatement().accept(adapter);
new SQLCreateTableStatement().accept(adapter);
new SQLDeleteStatement().accept(adapter);
new SQLCurrentOfCursorExpr().accept(adapter);
new SQLInsertStatement().accept(adapter);
new SQLUpdateStatement().accept(adapter);
new SQLNotNullConstraint().accept(adapter);
new SQLMethodInvokeExpr().accept(adapter);
new SQLCallStatement().accept(adapter);
new SQLSomeExpr().accept(adapter);
new SQLAnyExpr().accept(adapter);
new SQLAllExpr().accept(adapter);
new SQLDefaultExpr().accept(adapter);
new SQLCommentStatement().accept(adapter);
new SQLDropViewStatement().accept(adapter);
new SQLSavePointStatement().accept(adapter);
new SQLReleaseSavePointStatement().accept(adapter);
new SQLCreateDatabaseStatement().accept(adapter);
new SQLAlterTableDropIndex().accept(adapter);
new SQLOver().accept(adapter);
new SQLWithSubqueryClause().accept(adapter);
new SQLAlterTableAlterColumn().accept(adapter);
new SQLAlterTableStatement().accept(adapter);
new SQLAlterTableDisableConstraint().accept(adapter);
new SQLAlterTableEnableConstraint().accept(adapter);
new SQLColumnCheck().accept(adapter);
new SQLExprHint().accept(adapter);
new SQLAlterTableDropConstraint().accept(adapter);
}
Aggregations