use of net.sf.jsqlparser.statement.execute.Execute in project herddb by diennea.
the class SQLPlanner method plan.
@Override
public ExecutionPlan plan(String defaultTableSpace, net.sf.jsqlparser.statement.Statement stmt, boolean scan, boolean returnValues, int maxRows) {
verifyJdbcParametersIndexes(stmt);
ExecutionPlan result;
if (stmt instanceof CreateTable) {
result = ExecutionPlan.simple(buildCreateTableStatement(defaultTableSpace, (CreateTable) stmt));
} else if (stmt instanceof CreateIndex) {
result = ExecutionPlan.simple(buildCreateIndexStatement(defaultTableSpace, (CreateIndex) stmt));
} else if (stmt instanceof Insert) {
result = buildInsertStatement(defaultTableSpace, (Insert) stmt, returnValues);
} else if (stmt instanceof Delete) {
result = buildDeleteStatement(defaultTableSpace, (Delete) stmt, returnValues);
} else if (stmt instanceof Update) {
result = buildUpdateStatement(defaultTableSpace, (Update) stmt, returnValues);
} else if (stmt instanceof Select) {
result = buildSelectStatement(defaultTableSpace, (Select) stmt, scan, maxRows);
} else if (stmt instanceof Execute) {
result = ExecutionPlan.simple(buildExecuteStatement(defaultTableSpace, (Execute) stmt));
} else if (stmt instanceof Alter) {
result = ExecutionPlan.simple(buildAlterStatement(defaultTableSpace, (Alter) stmt));
} else if (stmt instanceof Drop) {
result = ExecutionPlan.simple(buildDropStatement(defaultTableSpace, (Drop) stmt));
} else if (stmt instanceof Truncate) {
result = ExecutionPlan.simple(buildTruncateStatement(defaultTableSpace, (Truncate) stmt));
} else {
return null;
}
return result;
}
use of net.sf.jsqlparser.statement.execute.Execute in project JSqlParser by JSQLParser.
the class ExecuteDeParserTest method shouldDeParseExecute.
@Test
public void shouldDeParseExecute() {
Execute execute = new Execute();
String name = "name";
ExpressionList exprList = new ExpressionList();
List<Expression> expressions = new ArrayList<Expression>();
Expression expression1 = mock(Expression.class);
Expression expression2 = mock(Expression.class);
execute.setName(name);
execute.setExprList(exprList);
exprList.setExpressions(expressions);
expressions.add(expression1);
expressions.add(expression2);
executeDeParser.deParse(execute);
String actual = buffer.toString();
assertTrue(actual.matches("EXECUTE " + name + " .*?, .*"));
}
use of net.sf.jsqlparser.statement.execute.Execute in project JSqlParser by JSQLParser.
the class StatementDeParserTest method shouldUseProvidedDeParserWhenDeParsingExecute.
@Test
@SuppressWarnings("PMD.JUnitTestsShouldIncludeAssert")
public void shouldUseProvidedDeParserWhenDeParsingExecute() {
Execute execute = new Execute();
ExpressionList exprList = new ExpressionList();
List<Expression> expressions = new ArrayList<Expression>();
Expression expression1 = mock(Expression.class);
Expression expression2 = mock(Expression.class);
execute.setExprList(exprList);
exprList.setExpressions(expressions);
expressions.add(expression1);
expressions.add(expression2);
statementDeParser.visit(execute);
then(expression1).should().accept(expressionDeParser);
then(expression2).should().accept(expressionDeParser);
}
use of net.sf.jsqlparser.statement.execute.Execute in project JSqlParser by JSQLParser.
the class ExecuteDeParserTest method shouldUseProvidedExpressionVisitorWhenDeParsingExecute.
@Test
public void shouldUseProvidedExpressionVisitorWhenDeParsingExecute() {
Execute execute = new Execute();
String name = "name";
ExpressionList exprList = new ExpressionList();
List<Expression> expressions = new ArrayList<Expression>();
Expression expression1 = mock(Expression.class);
Expression expression2 = mock(Expression.class);
execute.setName(name);
execute.setExprList(exprList);
exprList.setExpressions(expressions);
expressions.add(expression1);
expressions.add(expression2);
executeDeParser.deParse(execute);
then(expression1).should().accept(expressionVisitor);
then(expression2).should().accept(expressionVisitor);
}
Aggregations