Package org.eigenbase.sql.util

Examples of org.eigenbase.sql.util.SqlBuilder


    public void create(
        FemSqlobjectType type,
        GeneratedDdlStmt stmt)
    {
        SqlBuilder sb = createSqlBuilder();
        createHeader(sb, "TYPE", stmt);
        name(sb, type.getNamespace(), type.getName());
        sb.append(" AS");
        addColumns(sb, type);
        sb.append(NL);
        sb.append(maybeNot(type.isFinal(), "FINAL"));
        sb.append(NL);
        sb.append(maybeNot(!type.isAbstract(), "INSTANTIABLE"));
        addDescription(sb, type);

        addOperations(sb, Util.filter(type.getFeature(), CwmOperation.class));
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here


    public void create(
        FemSqldistinguishedType type,
        GeneratedDdlStmt stmt)
    {
        SqlBuilder sb = createSqlBuilder();
        createHeader(sb, "TYPE", stmt);
        name(sb, type.getNamespace(), type.getName());
        sb.append(" AS ");

        appendType(
            sb,
            type.getType(),
            type.getPrecision(),
            type.getScale(),
            type.getLength(),
            null,
            null,
            true);

        sb.append(NL);
        sb.append(maybeNot(type.isFinal(), "FINAL"));
        sb.append(NL);
        sb.append(maybeNot(!type.isAbstract(), "INSTANTIABLE"));
        addDescription(sb, type);
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

    public void create(
        FemDataServer server,
        GeneratedDdlStmt stmt)
    {
        SqlBuilder sb = createSqlBuilder();
        createHeader(sb, "SERVER", stmt);

        name(sb, null, server.getName());
        stmt.addStmt(sb.getSqlAndClear());

        // "TYPE" clause is optional
        final String type = server.getType();
        if ((type != null) && !type.equals("UNKNOWN")) {
            sb.append(" TYPE ");
            sb.literal(type);
        }

        // "VERSION" clause is optional
        final String version = server.getVersion();
        if ((version != null) && !version.equals("UNKNOWN")) {
            sb.append(" VERSION ");
            sb.literal(version);
        }
        sb.append(NL);
        sb.append("FOREIGN DATA WRAPPER ");
        name(sb, null, server.getWrapper().getName());
        addOptions(
            sb,
            server.getStorageOptions());
        addDescription(sb, server);
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

    public void drop(
        CwmSchema schema,
        GeneratedDdlStmt stmt)
    {
        SqlBuilder sb = createSqlBuilder();
        sb.append("DROP SCHEMA ");
        name(sb, null, schema.getName());
        if (dropCascade) {
            sb.append(" CASCADE");
        }
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

    public void drop(
        CwmTable table,
        GeneratedDdlStmt stmt)
    {
        SqlBuilder sb = createSqlBuilder();
        sb.append("DROP TABLE ");
        name(sb, table.getNamespace(), table.getName());
        if (dropCascade) {
            sb.append(" CASCADE");
        }
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

            || index.getName().startsWith("SYS$CONSTRAINT_INDEX$")
            || index.getName().startsWith("SYS$DELETION_INDEX"))
        {
            stmt.setTopLevel(false);
        }
        SqlBuilder sb = createSqlBuilder();
        createHeader(
            sb,
            index.isClustered() ? "CLUSTERED INDEX" : "INDEX",
            stmt);
        name(sb, null, index.getName());
        sb.append(" ON ");
        final CwmClass spanned = index.getSpannedClass();
        name(sb, spanned.getNamespace(), spanned.getName());
        sb.append(" (");
        int k = -1;
        for (CwmIndexedFeature feature : index.getIndexedFeature()) {
            if (++k > 0) {
                sb.append(", ");
            }
            sb.identifier(feature.getName());
        }
        sb.append(")");
        addDescription(sb, index);
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

    public void create(
        FemLabel label,
        GeneratedDdlStmt stmt)
    {
        SqlBuilder sb = createSqlBuilder();
        createHeader(sb, "LABEL", stmt);
        name(sb, null, label.getName());
        if (label.getParentLabel() != null) {
            sb.append(" FROM LABEL ");
            name(sb, null, label.getParentLabel().getName());
        }
        addDescription(sb, label);
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

        GeneratedDdlStmt stmt)
    {
        if (e == null) {
            return;
        }
        SqlBuilder sb = createSqlBuilder();
        sb.append("DROP ").append(elementType).append(" ");

        name(sb, e.getNamespace(), e.getName());
        if (dropCascade) {
            sb.append(" CASCADE");
        }
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

              && generateSetSchema(stmt, view.getNamespace().getName(), false))
        {
            stmt.addStmt(";" + NL);
        }

        SqlBuilder sb = createSqlBuilder();
        createHeader(sb, "VIEW", stmt);
        name(sb, view.getNamespace(), view.getName());
        addDescription(sb, view);
        sb.append(" AS");
        sb.append(NL);
        stmt.addStmt(sb.getSqlAndClear());

        if (!uglyViews) {
            sb.append(view.getOriginalDefinition());
        } else {
            sb.append(view.getQueryExpression().getBody());
        }
        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

    public void create(
        FemLocalSchema schema,
        GeneratedDdlStmt stmt)
    {
        SqlBuilder sb = createSqlBuilder();
        createHeader(sb, "SCHEMA", stmt);

        name(sb, null, schema.getName());
        addDescription(sb, schema);

        stmt.addStmt(sb.getSqlAndClear());
    }
View Full Code Here

TOP

Related Classes of org.eigenbase.sql.util.SqlBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.