Search in sources :

Example 1 with CreateIndexFinalStep

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

the class ParserImpl method parseCreateIndex.

private static final DDLQuery parseCreateIndex(ParserContext ctx) {
    boolean ifNotExists = parseKeywordIf(ctx, "IF NOT EXISTS");
    Name indexName = parseIndexName(ctx);
    parseKeyword(ctx, "ON");
    Table<?> tableName = parseTableName(ctx);
    parse(ctx, '(');
    Field<?>[] fieldNames = Tools.fieldsByName(parseIdentifiers(ctx));
    parse(ctx, ')');
    Condition condition = parseKeywordIf(ctx, "WHERE") ? parseCondition(ctx) : null;
    CreateIndexStep s1 = ifNotExists ? ctx.dsl.createIndexIfNotExists(indexName) : ctx.dsl.createIndex(indexName);
    CreateIndexWhereStep s2 = s1.on(tableName, fieldNames);
    CreateIndexFinalStep s3 = condition != null ? s2.where(condition) : s2;
    return s3;
}
Also used : Condition(org.jooq.Condition) TableField(org.jooq.TableField) GroupField(org.jooq.GroupField) Field(org.jooq.Field) SortField(org.jooq.SortField) CreateIndexFinalStep(org.jooq.CreateIndexFinalStep) CreateIndexWhereStep(org.jooq.CreateIndexWhereStep) CreateIndexStep(org.jooq.CreateIndexStep) Name(org.jooq.Name)

Aggregations

Condition (org.jooq.Condition)1 CreateIndexFinalStep (org.jooq.CreateIndexFinalStep)1 CreateIndexStep (org.jooq.CreateIndexStep)1 CreateIndexWhereStep (org.jooq.CreateIndexWhereStep)1 Field (org.jooq.Field)1 GroupField (org.jooq.GroupField)1 Name (org.jooq.Name)1 SortField (org.jooq.SortField)1 TableField (org.jooq.TableField)1