Java Code Examples for net.sf.jsqlparser.statement.create.index.CreateIndex

The following examples show how to use net.sf.jsqlparser.statement.create.index.CreateIndex. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: herddb   Source File: DDLSQLPlanner.java    License: Apache License 2.0 6 votes vote down vote up
private ExecutionPlan plan(
        String defaultTableSpace, net.sf.jsqlparser.statement.Statement stmt,
        boolean scan, boolean returnValues, int maxRows
) {
    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 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;
}
 
Example 2
Source Project: herddb   Source File: DDLSQLPlanner.java    License: Apache License 2.0 5 votes vote down vote up
private Statement buildCreateIndexStatement(String defaultTableSpace, CreateIndex s) throws StatementExecutionException {
    try {
        String tableSpace = s.getTable().getSchemaName();
        if (tableSpace == null) {
            tableSpace = defaultTableSpace;
        }
        String tableName = s.getTable().getName().toLowerCase();

        String indexName = s.getIndex().getName().toLowerCase();
        String indexType = convertIndexType(s.getIndex().getType());

        herddb.model.Index.Builder builder = herddb.model.Index
                .builder()
                .name(indexName)
                .uuid(UUID.randomUUID().toString())
                .type(indexType)
                .table(tableName)
                .tablespace(tableSpace);

        AbstractTableManager tableDefinition = manager.getTableSpaceManager(tableSpace).getTableManager(tableName);
        if (tableDefinition == null) {
            throw new TableDoesNotExistException("no such table " + tableName + " in tablespace " + tableSpace);
        }
        for (String columnName : s.getIndex().getColumnsNames()) {
            columnName = columnName.toLowerCase();
            Column column = tableDefinition.getTable().getColumn(columnName);
            if (column == null) {
                throw new StatementExecutionException(
                        "no such column " + columnName + " on table " + tableName + " in tablespace " + tableSpace);
            }
            builder.column(column.name, column.type);
        }

        CreateIndexStatement statement = new CreateIndexStatement(builder.build());
        return statement;
    } catch (IllegalArgumentException err) {
        throw new StatementExecutionException("bad index definition: " + err.getMessage(), err);
    }
}
 
Example 3
Source Project: jobson   Source File: AllColumnRefsFinder.java    License: Apache License 2.0 4 votes vote down vote up
public void visit(CreateIndex createIndex) {
    throw new UnsupportedSQLFeatureException("Feature CreateIndex not supported");
}
 
Example 4
Source Project: evosql   Source File: TablesNamesFinder.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void visit(CreateIndex createIndex) {
    throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
 
Example 5
Source Project: compass   Source File: TableRenameVisitor.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void visit(CreateIndex createIndex) 
{
    throw new UnsupportedOperationException("Not supported yet."); 
}
 
Example 6
Source Project: foxtrot   Source File: SqlElementVisitor.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void visit(CreateIndex createIndex) {
    //supported construct
}
 
Example 7
Source Project: DDF   Source File: TableVisitor.java    License: Apache License 2.0 2 votes vote down vote up
@Override
public void visit(CreateIndex createIndex) throws Exception {

}