net.sf.jsqlparser.statement.truncate.Truncate Java Examples

The following examples show how to use net.sf.jsqlparser.statement.truncate.Truncate. 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 File: DDLSQLPlanner.java    From herddb with 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 File: DDLSQLPlanner.java    From herddb with Apache License 2.0 5 votes vote down vote up
private static boolean isCachable(net.sf.jsqlparser.statement.Statement stmt) {
    if (stmt instanceof Execute) {
        return false;
    } else if (stmt instanceof Alter) {
        return false;
    } else if (stmt instanceof Drop) {
        return false;
    } else {
        return !(stmt instanceof Truncate);
    }
}
 
Example #3
Source File: DDLSQLPlanner.java    From herddb with Apache License 2.0 5 votes vote down vote up
private Statement buildTruncateStatement(String defaultTableSpace, Truncate truncate) throws StatementExecutionException {

        if (truncate.getTable() == null) {
            throw new StatementExecutionException("missing table name");
        }

        String tableSpace = truncate.getTable().getSchemaName();
        if (tableSpace == null) {
            tableSpace = defaultTableSpace;
        }
        String tableName = fixMySqlBackTicks(truncate.getTable().getName().toLowerCase());
        return new TruncateTableStatement(tableSpace, tableName);
    }
 
Example #4
Source File: AllColumnRefsFinder.java    From jobson with Apache License 2.0 4 votes vote down vote up
public void visit(Truncate truncate) {
    throw new UnsupportedSQLFeatureException("Feature Truncate not supported");
}
 
Example #5
Source File: TablesNamesFinder.java    From evosql with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(Truncate truncate) {
    throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
 
Example #6
Source File: TableRenameVisitor.java    From compass with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(Truncate truncate)
{
    throw new UnsupportedOperationException("Not supported yet."); 
}
 
Example #7
Source File: SqlElementVisitor.java    From foxtrot with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(Truncate truncate) {
    //supported construct
}
 
Example #8
Source File: TableVisitor.java    From DDF with Apache License 2.0 2 votes vote down vote up
@Override
public void visit(Truncate truncate) throws Exception {

}