use of net.sf.jsqlparser.statement.create.index.CreateIndex 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.create.index.CreateIndex in project herddb by diennea.
the class JdbcQueryRewriter method visit.
@Override
public void visit(CreateIndex createIndex) {
visit(createIndex.getTable());
Index index = createIndex.getIndex();
visit(index);
}
use of net.sf.jsqlparser.statement.create.index.CreateIndex in project JSqlParser by JSQLParser.
the class CreateIndexTest method testCreateIndex4.
@Test
public void testCreateIndex4() throws JSQLParserException {
String statement = "CREATE mytype INDEX myindex ON mytab (mycol ASC, mycol2 (75), mycol3)";
CreateIndex createIndex = (CreateIndex) parserManager.parse(new StringReader(statement));
assertEquals(3, createIndex.getIndex().getColumnsNames().size());
assertEquals("myindex", createIndex.getIndex().getName());
assertEquals("mytype", createIndex.getIndex().getType());
assertEquals("mytab", createIndex.getTable().getFullyQualifiedName());
assertEquals("mycol3", createIndex.getIndex().getColumnsNames().get(2));
}
use of net.sf.jsqlparser.statement.create.index.CreateIndex in project JSqlParser by JSQLParser.
the class CreateIndexTest method testCreateIndex3.
@Test
public void testCreateIndex3() throws JSQLParserException {
String statement = "CREATE mytype INDEX myindex ON mytab (mycol ASC, mycol2, mycol3)";
CreateIndex createIndex = (CreateIndex) parserManager.parse(new StringReader(statement));
assertEquals(3, createIndex.getIndex().getColumnsNames().size());
assertEquals("myindex", createIndex.getIndex().getName());
assertEquals("mytype", createIndex.getIndex().getType());
assertEquals("mytab", createIndex.getTable().getFullyQualifiedName());
assertEquals("mycol3", createIndex.getIndex().getColumnsNames().get(2));
}
use of net.sf.jsqlparser.statement.create.index.CreateIndex in project JSqlParser by JSQLParser.
the class CreateIndexTest method testCreateIndex.
@Test
public void testCreateIndex() throws JSQLParserException {
String statement = "CREATE INDEX myindex ON mytab (mycol, mycol2)";
CreateIndex createIndex = (CreateIndex) parserManager.parse(new StringReader(statement));
assertEquals(2, createIndex.getIndex().getColumnsNames().size());
assertEquals("myindex", createIndex.getIndex().getName());
assertNull(createIndex.getIndex().getType());
assertEquals("mytab", createIndex.getTable().getFullyQualifiedName());
assertEquals("mycol", createIndex.getIndex().getColumnsNames().get(0));
assertEquals(statement, "" + createIndex);
}
Aggregations