Search in sources :

Example 1 with DropIndexOnStep

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

the class ParserImpl method parseDropIndex.

private static final DDLQuery parseDropIndex(ParserContext ctx) {
    boolean ifExists = parseKeywordIf(ctx, "IF EXISTS");
    Name indexName = parseIndexName(ctx);
    boolean on = parseKeywordIf(ctx, "ON");
    Table<?> onTable = on ? parseTableName(ctx) : null;
    DropIndexOnStep s1;
    DropIndexFinalStep s2;
    s1 = ifExists ? ctx.dsl.dropIndexIfExists(indexName) : ctx.dsl.dropIndex(indexName);
    s2 = on ? s1.on(onTable) : s1;
    return s2;
}
Also used : DropIndexOnStep(org.jooq.DropIndexOnStep) DropIndexFinalStep(org.jooq.DropIndexFinalStep) Name(org.jooq.Name)

Example 2 with DropIndexOnStep

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

the class DefaultParseContext method parseDropIndex.

private final DDLQuery parseDropIndex() {
    boolean ifExists = parseKeywordIf("IF EXISTS");
    Name indexName = parseIndexName();
    ifExists = ifExists || parseKeywordIf("IF EXISTS");
    boolean on = parseKeywordIf("ON");
    Table<?> onTable = on ? parseTableName() : null;
    DropIndexOnStep s1;
    DropIndexCascadeStep s2;
    s1 = ifExists ? dsl.dropIndexIfExists(indexName) : dsl.dropIndex(indexName);
    s2 = on ? s1.on(onTable) : s1;
    return parseKeywordIf("CASCADE") ? s2.cascade() : parseKeywordIf("RESTRICT") ? s2.restrict() : s2;
}
Also used : DropIndexOnStep(org.jooq.DropIndexOnStep) DropIndexCascadeStep(org.jooq.DropIndexCascadeStep) Name(org.jooq.Name) DSL.systemName(org.jooq.impl.DSL.systemName)

Aggregations

DropIndexOnStep (org.jooq.DropIndexOnStep)2 Name (org.jooq.Name)2 DropIndexCascadeStep (org.jooq.DropIndexCascadeStep)1 DropIndexFinalStep (org.jooq.DropIndexFinalStep)1 DSL.systemName (org.jooq.impl.DSL.systemName)1