Search in sources :

Example 1 with DropTableStep

use of org.jooq.DropTableStep in project jOOQ by jOOQ.

the class ParserImpl method parseDropTable.

private static final DDLQuery parseDropTable(ParserContext ctx) {
    boolean ifExists = parseKeywordIf(ctx, "IF EXISTS");
    Table<?> tableName = parseTableName(ctx);
    boolean cascade = parseKeywordIf(ctx, "CASCADE");
    boolean restrict = !cascade && parseKeywordIf(ctx, "RESTRICT");
    DropTableStep s1;
    DropTableFinalStep s2;
    s1 = ifExists ? ctx.dsl.dropTableIfExists(tableName) : ctx.dsl.dropTable(tableName);
    s2 = cascade ? s1.cascade() : restrict ? s1.restrict() : s1;
    return s2;
}
Also used : DropTableFinalStep(org.jooq.DropTableFinalStep) DropTableStep(org.jooq.DropTableStep)

Example 2 with DropTableStep

use of org.jooq.DropTableStep in project jOOQ by jOOQ.

the class DefaultParseContext method parseDropTable.

private final DDLQuery parseDropTable(boolean temporary) {
    boolean ifExists = parseKeywordIf("IF EXISTS");
    Table<?> tableName = parseTableName();
    ifExists = ifExists || parseKeywordIf("IF EXISTS");
    boolean cascade = parseKeywordIf("CASCADE") && (parseKeywordIf("CONSTRAINTS") || true);
    boolean restrict = !cascade && parseKeywordIf("RESTRICT");
    DropTableStep s1;
    s1 = ifExists ? dsl.dropTableIfExists(tableName) : temporary ? dsl.dropTemporaryTable(tableName) : dsl.dropTable(tableName);
    return cascade ? s1.cascade() : restrict ? s1.restrict() : s1;
}
Also used : DropTableStep(org.jooq.DropTableStep)

Aggregations

DropTableStep (org.jooq.DropTableStep)2 DropTableFinalStep (org.jooq.DropTableFinalStep)1