Search in sources :

Example 1 with CommentOnIsStep

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

the class DefaultParseContext method parseCommentOn.

private final DDLQuery parseCommentOn() {
    parseKeyword("COMMENT ON");
    CommentOnIsStep s1;
    if (parseKeywordIf("COLUMN")) {
        s1 = dsl.commentOnColumn(parseFieldName());
    } else if (parseKeywordIf("TABLE")) {
        Table<?> table = parseTableName();
        if (parseIf('(')) {
            s1 = dsl.commentOnColumn(table.getQualifiedName().append(parseIdentifier()));
            parseKeyword("IS");
            DDLQuery s2 = s1.is(parseStringLiteral());
            parse(')');
            return s2;
        } else
            s1 = dsl.commentOnTable(table);
    } else if (parseKeywordIf("VIEW")) {
        s1 = dsl.commentOnView(parseTableName());
    } else // https://docs.oracle.com/database/121/SQLRF/statements_4010.htm
    if (parseAndGetKeywordIf("ACCESS METHOD", "AUDIT POLICY", "COLLATION", "CONVERSION", "DATABASE", "DOMAIN", "EDITION", "EXTENSION", "EVENT TRIGGER", "FOREIGN DATA WRAPPER", "FOREIGN TABLE", "INDEX", "INDEXTYPE", "LANGUAGE", "LARGE OBJECT", "MATERIALIZED VIEW", "MINING MODEL", "OPERATOR", "PROCEDURAL LANGUAGE", "PUBLICATION", "ROLE", "SCHEMA", "SEQUENCE", "SERVER", "STATISTICS", "SUBSCRIPTION", "TABLESPACE", "TEXT SEARCH CONFIGURATION", "TEXT SEARCH DICTIONARY", "TEXT SEARCH PARSER", "TEXT SEARCH TEMPLATE", "TYPE", "VIEW") != null) {
        parseIdentifier();
        parseKeyword("IS");
        parseStringLiteral();
        return IGNORE;
    } else // https://www.postgresql.org/docs/10/static/sql-comment.html
    if (parseKeywordIf("CONSTRAINT")) {
        parseIdentifier();
        parseKeyword("ON");
        parseKeywordIf("DOMAIN");
        parseName();
        parseKeyword("IS");
        parseStringLiteral();
        return IGNORE;
    } else if (parseAndGetKeywordIf("POLICY", "RULE", "TRIGGER") != null) {
        parseIdentifier();
        parseKeyword("ON");
        parseIdentifier();
        parseKeyword("IS");
        parseStringLiteral();
        return IGNORE;
    } else if (parseKeywordIf("TRANSFORM FOR")) {
        parseIdentifier();
        parseKeyword("LANGUAGE");
        parseIdentifier();
        parseKeyword("IS");
        parseStringLiteral();
        return IGNORE;
    } else
        throw unsupportedClause();
    parseKeyword("IS");
    return s1.is(parseStringLiteral());
}
Also used : CommentOnIsStep(org.jooq.CommentOnIsStep) DSL.newTable(org.jooq.impl.DSL.newTable) Table(org.jooq.Table) DSL.finalTable(org.jooq.impl.DSL.finalTable) DSL.jsonTable(org.jooq.impl.DSL.jsonTable) DSL.oldTable(org.jooq.impl.DSL.oldTable) DDLQuery(org.jooq.DDLQuery)

Aggregations

CommentOnIsStep (org.jooq.CommentOnIsStep)1 DDLQuery (org.jooq.DDLQuery)1 Table (org.jooq.Table)1 DSL.finalTable (org.jooq.impl.DSL.finalTable)1 DSL.jsonTable (org.jooq.impl.DSL.jsonTable)1 DSL.newTable (org.jooq.impl.DSL.newTable)1 DSL.oldTable (org.jooq.impl.DSL.oldTable)1