Search in sources :

Example 1 with ConstraintEnforcementStep

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

the class DefaultParseContext method parseCheckSpecification.

private final Constraint parseCheckSpecification(ConstraintTypeStep constraint) {
    boolean parens = parseIf('(');
    Condition condition = parseCondition();
    if (parens)
        parse(')');
    ConstraintEnforcementStep e = constraint == null ? check(condition) : constraint.check(condition);
    return parseConstraintEnforcementIf(e);
}
Also used : Condition(org.jooq.Condition) ConstraintEnforcementStep(org.jooq.ConstraintEnforcementStep)

Example 2 with ConstraintEnforcementStep

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

the class DefaultParseContext method parsePrimaryKeySpecification.

private final Constraint parsePrimaryKeySpecification(ConstraintTypeStep constraint) {
    parseUsingIndexTypeIf();
    Field<?>[] fieldNames = parseKeyColumnList();
    ConstraintEnforcementStep e = constraint == null ? primaryKey(fieldNames) : constraint.primaryKey(fieldNames);
    parseUsingIndexTypeIf();
    return parseConstraintEnforcementIf(e);
}
Also used : GroupField(org.jooq.GroupField) TableField(org.jooq.TableField) Field(org.jooq.Field) SortField(org.jooq.SortField) SelectField(org.jooq.SelectField) ConstraintEnforcementStep(org.jooq.ConstraintEnforcementStep)

Example 3 with ConstraintEnforcementStep

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

the class DefaultParseContext method parseUniqueSpecification.

private final Constraint parseUniqueSpecification(ConstraintTypeStep constraint) {
    parseUsingIndexTypeIf();
    // [#9246] In MySQL, there's a syntax where the unique constraint looks like an index:
    // ALTER TABLE t ADD UNIQUE INDEX i (c)
    Name constraintName;
    if (constraint == null && (constraintName = parseIdentifierIf()) != null)
        constraint = constraint(constraintName);
    Field<?>[] fieldNames = parseKeyColumnList();
    ConstraintEnforcementStep e = constraint == null ? unique(fieldNames) : constraint.unique(fieldNames);
    parseUsingIndexTypeIf();
    return parseConstraintEnforcementIf(e);
}
Also used : GroupField(org.jooq.GroupField) TableField(org.jooq.TableField) Field(org.jooq.Field) SortField(org.jooq.SortField) SelectField(org.jooq.SelectField) ConstraintEnforcementStep(org.jooq.ConstraintEnforcementStep) Name(org.jooq.Name) DSL.systemName(org.jooq.impl.DSL.systemName)

Aggregations

ConstraintEnforcementStep (org.jooq.ConstraintEnforcementStep)3 Field (org.jooq.Field)2 GroupField (org.jooq.GroupField)2 SelectField (org.jooq.SelectField)2 SortField (org.jooq.SortField)2 TableField (org.jooq.TableField)2 Condition (org.jooq.Condition)1 Name (org.jooq.Name)1 DSL.systemName (org.jooq.impl.DSL.systemName)1