Search in sources :

Example 11 with Update

use of org.h2.command.dml.Update in project ignite by apache.

the class GridSqlUpdate method getSQL.

/**
 * {@inheritDoc}
 */
@Override
public String getSQL() {
    StatementBuilder buff = new StatementBuilder(explain() ? "EXPLAIN " : "");
    buff.append("UPDATE ").append(target.getSQL()).append("\nSET\n");
    for (GridSqlColumn c : cols) {
        GridSqlElement e = set.get(c.columnName());
        buff.appendExceptFirst(",\n    ");
        buff.append(c.columnName()).append(" = ").append(e != null ? e.getSQL() : "DEFAULT");
    }
    if (where != null)
        buff.append("\nWHERE ").append(StringUtils.unEnclose(where.getSQL()));
    if (limit != null)
        buff.append("\nLIMIT ").append(StringUtils.unEnclose(limit.getSQL()));
    return buff.toString();
}
Also used : StatementBuilder(org.h2.util.StatementBuilder)

Example 12 with Update

use of org.h2.command.dml.Update in project ignite by apache.

the class DmlAstUtils method getFastUpdateArgs.

/**
 * @param update UPDATE statement.
 * @return {@code null} if given statement directly updates {@code _val} column with a literal or param value
 * and filters by single non expression key (and, optionally,  by single non expression value).
 */
public static FastUpdate getFastUpdateArgs(GridSqlUpdate update) {
    IgnitePair<GridSqlElement> filter = findKeyValueEqualityCondition(update.where());
    if (filter == null)
        return null;
    if (update.cols().size() != 1)
        return null;
    Table tbl = update.cols().get(0).column().getTable();
    if (!(tbl instanceof GridH2Table))
        return null;
    GridH2RowDescriptor desc = ((GridH2Table) tbl).rowDescriptor();
    if (!desc.isValueColumn(update.cols().get(0).column().getColumnId()))
        return null;
    GridSqlElement set = update.set().get(update.cols().get(0).columnName());
    if (!(set instanceof GridSqlConst || set instanceof GridSqlParameter))
        return null;
    return FastUpdate.create(filter.getKey(), filter.getValue(), set);
}
Also used : GridH2Table(org.apache.ignite.internal.processors.query.h2.opt.GridH2Table) Table(org.h2.table.Table) GridSqlTable(org.apache.ignite.internal.processors.query.h2.sql.GridSqlTable) GridH2RowDescriptor(org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor) GridSqlConst(org.apache.ignite.internal.processors.query.h2.sql.GridSqlConst) GridH2Table(org.apache.ignite.internal.processors.query.h2.opt.GridH2Table) GridSqlElement(org.apache.ignite.internal.processors.query.h2.sql.GridSqlElement) GridSqlParameter(org.apache.ignite.internal.processors.query.h2.sql.GridSqlParameter)

Example 13 with Update

use of org.h2.command.dml.Update in project h2database by h2database.

the class Parser method parseAlterTable.

private Prepared parseAlterTable() {
    boolean ifTableExists = readIfExists(false);
    String tableName = readIdentifierWithSchema();
    Schema schema = getSchema();
    if (readIf("ADD")) {
        Prepared command = parseAlterTableAddConstraintIf(tableName, schema, ifTableExists);
        if (command != null) {
            return command;
        }
        return parseAlterTableAddColumn(tableName, schema, ifTableExists);
    } else if (readIf("SET")) {
        read("REFERENTIAL_INTEGRITY");
        int type = CommandInterface.ALTER_TABLE_SET_REFERENTIAL_INTEGRITY;
        boolean value = readBooleanSetting();
        AlterTableSet command = new AlterTableSet(session, schema, type, value);
        command.setTableName(tableName);
        command.setIfTableExists(ifTableExists);
        if (readIf("CHECK")) {
            command.setCheckExisting(true);
        } else if (readIf("NOCHECK")) {
            command.setCheckExisting(false);
        }
        return command;
    } else if (readIf("RENAME")) {
        if (readIf("COLUMN")) {
            // PostgreSQL syntax
            String columnName = readColumnIdentifier();
            read("TO");
            AlterTableRenameColumn command = new AlterTableRenameColumn(session, schema);
            command.setTableName(tableName);
            command.setIfTableExists(ifTableExists);
            command.setOldColumnName(columnName);
            String newName = readColumnIdentifier();
            command.setNewColumnName(newName);
            return command;
        } else if (readIf("CONSTRAINT")) {
            String constraintName = readIdentifierWithSchema(schema.getName());
            checkSchema(schema);
            read("TO");
            AlterTableRenameConstraint command = new AlterTableRenameConstraint(session, schema);
            command.setConstraintName(constraintName);
            String newName = readColumnIdentifier();
            command.setNewConstraintName(newName);
            return commandIfTableExists(schema, tableName, ifTableExists, command);
        } else {
            read("TO");
            String newName = readIdentifierWithSchema(schema.getName());
            checkSchema(schema);
            AlterTableRename command = new AlterTableRename(session, getSchema());
            command.setOldTableName(tableName);
            command.setNewTableName(newName);
            command.setIfTableExists(ifTableExists);
            command.setHidden(readIf("HIDDEN"));
            return command;
        }
    } else if (readIf("DROP")) {
        if (readIf("CONSTRAINT")) {
            boolean ifExists = readIfExists(false);
            String constraintName = readIdentifierWithSchema(schema.getName());
            ifExists = readIfExists(ifExists);
            checkSchema(schema);
            AlterTableDropConstraint command = new AlterTableDropConstraint(session, getSchema(), ifExists);
            command.setConstraintName(constraintName);
            return commandIfTableExists(schema, tableName, ifTableExists, command);
        } else if (readIf("FOREIGN")) {
            // MySQL compatibility
            read("KEY");
            String constraintName = readIdentifierWithSchema(schema.getName());
            checkSchema(schema);
            AlterTableDropConstraint command = new AlterTableDropConstraint(session, getSchema(), false);
            command.setConstraintName(constraintName);
            return commandIfTableExists(schema, tableName, ifTableExists, command);
        } else if (readIf("INDEX")) {
            // MySQL compatibility
            String indexOrConstraintName = readIdentifierWithSchema();
            final SchemaCommand command;
            if (schema.findIndex(session, indexOrConstraintName) != null) {
                DropIndex dropIndexCommand = new DropIndex(session, getSchema());
                dropIndexCommand.setIndexName(indexOrConstraintName);
                command = dropIndexCommand;
            } else {
                AlterTableDropConstraint dropCommand = new AlterTableDropConstraint(session, getSchema(), false);
                dropCommand.setConstraintName(indexOrConstraintName);
                command = dropCommand;
            }
            return commandIfTableExists(schema, tableName, ifTableExists, command);
        } else if (readIf("PRIMARY")) {
            read("KEY");
            Table table = tableIfTableExists(schema, tableName, ifTableExists);
            if (table == null) {
                return new NoOperation(session);
            }
            Index idx = table.getPrimaryKey();
            DropIndex command = new DropIndex(session, schema);
            command.setIndexName(idx.getName());
            return command;
        } else {
            readIf("COLUMN");
            boolean ifExists = readIfExists(false);
            ArrayList<Column> columnsToRemove = New.arrayList();
            Table table = tableIfTableExists(schema, tableName, ifTableExists);
            // For Oracle compatibility - open bracket required
            boolean openingBracketDetected = readIf("(");
            do {
                String columnName = readColumnIdentifier();
                if (table != null) {
                    if (!ifExists || table.doesColumnExist(columnName)) {
                        Column column = table.getColumn(columnName);
                        columnsToRemove.add(column);
                    }
                }
            } while (readIf(","));
            if (openingBracketDetected) {
                // For Oracle compatibility - close bracket
                read(")");
            }
            if (table == null || columnsToRemove.isEmpty()) {
                return new NoOperation(session);
            }
            AlterTableAlterColumn command = new AlterTableAlterColumn(session, schema);
            command.setType(CommandInterface.ALTER_TABLE_DROP_COLUMN);
            command.setTableName(tableName);
            command.setIfTableExists(ifTableExists);
            command.setColumnsToRemove(columnsToRemove);
            return command;
        }
    } else if (readIf("CHANGE")) {
        // MySQL compatibility
        readIf("COLUMN");
        String columnName = readColumnIdentifier();
        String newColumnName = readColumnIdentifier();
        Column column = columnIfTableExists(schema, tableName, columnName, ifTableExists);
        boolean nullable = column == null ? true : column.isNullable();
        // new column type ignored. RENAME and MODIFY are
        // a single command in MySQL but two different commands in H2.
        parseColumnForTable(newColumnName, nullable);
        AlterTableRenameColumn command = new AlterTableRenameColumn(session, schema);
        command.setTableName(tableName);
        command.setIfTableExists(ifTableExists);
        command.setOldColumnName(columnName);
        command.setNewColumnName(newColumnName);
        return command;
    } else if (readIf("MODIFY")) {
        // MySQL compatibility (optional)
        readIf("COLUMN");
        // Oracle specifies (but will not require) an opening parenthesis
        boolean hasOpeningBracket = readIf("(");
        String columnName = readColumnIdentifier();
        AlterTableAlterColumn command = null;
        NullConstraintType nullConstraint = parseNotNullConstraint();
        switch(nullConstraint) {
            case NULL_IS_ALLOWED:
            case NULL_IS_NOT_ALLOWED:
                command = new AlterTableAlterColumn(session, schema);
                command.setTableName(tableName);
                command.setIfTableExists(ifTableExists);
                Column column = columnIfTableExists(schema, tableName, columnName, ifTableExists);
                command.setOldColumn(column);
                if (nullConstraint == NullConstraintType.NULL_IS_ALLOWED) {
                    command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_NULL);
                } else {
                    command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_NOT_NULL);
                }
                break;
            case NO_NULL_CONSTRAINT_FOUND:
                command = parseAlterTableAlterColumnType(schema, tableName, columnName, ifTableExists);
                break;
            default:
                throw DbException.get(ErrorCode.UNKNOWN_MODE_1, "Internal Error - unhandled case: " + nullConstraint.name());
        }
        if (hasOpeningBracket) {
            read(")");
        }
        return command;
    } else if (readIf("ALTER")) {
        readIf("COLUMN");
        String columnName = readColumnIdentifier();
        Column column = columnIfTableExists(schema, tableName, columnName, ifTableExists);
        if (readIf("RENAME")) {
            read("TO");
            AlterTableRenameColumn command = new AlterTableRenameColumn(session, schema);
            command.setTableName(tableName);
            command.setIfTableExists(ifTableExists);
            command.setOldColumnName(columnName);
            String newName = readColumnIdentifier();
            command.setNewColumnName(newName);
            return command;
        } else if (readIf("DROP")) {
            // PostgreSQL compatibility
            if (readIf("DEFAULT")) {
                AlterTableAlterColumn command = new AlterTableAlterColumn(session, schema);
                command.setTableName(tableName);
                command.setIfTableExists(ifTableExists);
                command.setOldColumn(column);
                command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_DEFAULT);
                command.setDefaultExpression(null);
                return command;
            }
            if (readIf("ON")) {
                read("UPDATE");
                AlterTableAlterColumn command = new AlterTableAlterColumn(session, schema);
                command.setTableName(tableName);
                command.setIfTableExists(ifTableExists);
                command.setOldColumn(column);
                command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_ON_UPDATE);
                command.setDefaultExpression(null);
                return command;
            }
            read("NOT");
            read("NULL");
            AlterTableAlterColumn command = new AlterTableAlterColumn(session, schema);
            command.setTableName(tableName);
            command.setIfTableExists(ifTableExists);
            command.setOldColumn(column);
            command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_NULL);
            return command;
        } else if (readIf("TYPE")) {
            // PostgreSQL compatibility
            return parseAlterTableAlterColumnType(schema, tableName, columnName, ifTableExists);
        } else if (readIf("SET")) {
            if (readIf("DATA")) {
                // Derby compatibility
                read("TYPE");
                return parseAlterTableAlterColumnType(schema, tableName, columnName, ifTableExists);
            }
            AlterTableAlterColumn command = new AlterTableAlterColumn(session, schema);
            command.setTableName(tableName);
            command.setIfTableExists(ifTableExists);
            command.setOldColumn(column);
            NullConstraintType nullConstraint = parseNotNullConstraint();
            switch(nullConstraint) {
                case NULL_IS_ALLOWED:
                    command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_NULL);
                    break;
                case NULL_IS_NOT_ALLOWED:
                    command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_NOT_NULL);
                    break;
                case NO_NULL_CONSTRAINT_FOUND:
                    if (readIf("DEFAULT")) {
                        Expression defaultExpression = readExpression();
                        command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_DEFAULT);
                        command.setDefaultExpression(defaultExpression);
                    } else if (readIf("ON")) {
                        read("UPDATE");
                        Expression onUpdateExpression = readExpression();
                        command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_ON_UPDATE);
                        command.setDefaultExpression(onUpdateExpression);
                    } else if (readIf("INVISIBLE")) {
                        command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_VISIBILITY);
                        command.setVisible(false);
                    } else if (readIf("VISIBLE")) {
                        command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_VISIBILITY);
                        command.setVisible(true);
                    }
                    break;
                default:
                    throw DbException.get(ErrorCode.UNKNOWN_MODE_1, "Internal Error - unhandled case: " + nullConstraint.name());
            }
            return command;
        } else if (readIf("RESTART")) {
            readIf("WITH");
            Expression start = readExpression();
            AlterSequence command = new AlterSequence(session, schema);
            command.setColumn(column);
            command.setStartWith(start);
            return commandIfTableExists(schema, tableName, ifTableExists, command);
        } else if (readIf("SELECTIVITY")) {
            AlterTableAlterColumn command = new AlterTableAlterColumn(session, schema);
            command.setTableName(tableName);
            command.setIfTableExists(ifTableExists);
            command.setType(CommandInterface.ALTER_TABLE_ALTER_COLUMN_SELECTIVITY);
            command.setOldColumn(column);
            command.setSelectivity(readExpression());
            return command;
        } else {
            return parseAlterTableAlterColumnType(schema, tableName, columnName, ifTableExists);
        }
    }
    throw getSyntaxError();
}
Also used : AlterSequence(org.h2.command.dml.AlterSequence) RangeTable(org.h2.table.RangeTable) TruncateTable(org.h2.command.ddl.TruncateTable) CreateTable(org.h2.command.ddl.CreateTable) FunctionTable(org.h2.table.FunctionTable) CreateLinkedTable(org.h2.command.ddl.CreateLinkedTable) Table(org.h2.table.Table) DropTable(org.h2.command.ddl.DropTable) DropSchema(org.h2.command.ddl.DropSchema) CreateSchema(org.h2.command.ddl.CreateSchema) Schema(org.h2.schema.Schema) AlterTableRename(org.h2.command.ddl.AlterTableRename) DropIndex(org.h2.command.ddl.DropIndex) Index(org.h2.index.Index) CreateIndex(org.h2.command.ddl.CreateIndex) ValueString(org.h2.value.ValueString) AlterTableAlterColumn(org.h2.command.ddl.AlterTableAlterColumn) SchemaCommand(org.h2.command.ddl.SchemaCommand) AlterTableSet(org.h2.command.dml.AlterTableSet) AlterTableDropConstraint(org.h2.command.ddl.AlterTableDropConstraint) AlterTableRenameConstraint(org.h2.command.ddl.AlterTableRenameConstraint) NoOperation(org.h2.command.dml.NoOperation) AlterTableRenameColumn(org.h2.command.ddl.AlterTableRenameColumn) AlterTableAlterColumn(org.h2.command.ddl.AlterTableAlterColumn) Column(org.h2.table.Column) ExpressionColumn(org.h2.expression.ExpressionColumn) IndexColumn(org.h2.table.IndexColumn) Expression(org.h2.expression.Expression) ValueExpression(org.h2.expression.ValueExpression) AlterTableRenameColumn(org.h2.command.ddl.AlterTableRenameColumn) DropIndex(org.h2.command.ddl.DropIndex)

Example 14 with Update

use of org.h2.command.dml.Update in project h2database by h2database.

the class Parser method parseColumnForTable.

private Column parseColumnForTable(String columnName, boolean defaultNullable) {
    Column column;
    boolean isIdentity = readIf("IDENTITY");
    if (isIdentity || readIf("BIGSERIAL")) {
        // Check if any of them are disallowed in the current Mode
        if (isIdentity && database.getMode().disallowedTypes.contains("IDENTITY")) {
            throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, currentToken);
        }
        column = new Column(columnName, Value.LONG);
        column.setOriginalSQL("IDENTITY");
        parseAutoIncrement(column);
        // PostgreSQL compatibility
        if (!database.getMode().serialColumnIsNotPK) {
            column.setPrimaryKey(true);
        }
    } else if (readIf("SERIAL")) {
        column = new Column(columnName, Value.INT);
        column.setOriginalSQL("SERIAL");
        parseAutoIncrement(column);
        // PostgreSQL compatibility
        if (!database.getMode().serialColumnIsNotPK) {
            column.setPrimaryKey(true);
        }
    } else {
        column = parseColumnWithType(columnName);
    }
    if (readIf("INVISIBLE")) {
        column.setVisible(false);
    } else if (readIf("VISIBLE")) {
        column.setVisible(true);
    }
    NullConstraintType nullConstraint = parseNotNullConstraint();
    switch(nullConstraint) {
        case NULL_IS_ALLOWED:
            column.setNullable(true);
            break;
        case NULL_IS_NOT_ALLOWED:
            column.setNullable(false);
            break;
        case NO_NULL_CONSTRAINT_FOUND:
            // domains may be defined as not nullable
            column.setNullable(defaultNullable & column.isNullable());
            break;
        default:
            throw DbException.get(ErrorCode.UNKNOWN_MODE_1, "Internal Error - unhandled case: " + nullConstraint.name());
    }
    if (readIf("AS")) {
        if (isIdentity) {
            getSyntaxError();
        }
        Expression expr = readExpression();
        column.setComputedExpression(expr);
    } else if (readIf("DEFAULT")) {
        Expression defaultExpression = readExpression();
        column.setDefaultExpression(session, defaultExpression);
    } else if (readIf("GENERATED")) {
        if (!readIf("ALWAYS")) {
            read("BY");
            read("DEFAULT");
        }
        read("AS");
        read("IDENTITY");
        long start = 1, increment = 1;
        if (readIf("(")) {
            read("START");
            readIf("WITH");
            start = readLong();
            readIf(",");
            if (readIf("INCREMENT")) {
                readIf("BY");
                increment = readLong();
            }
            read(")");
        }
        column.setPrimaryKey(true);
        column.setAutoIncrement(true, start, increment);
    }
    if (readIf("ON")) {
        read("UPDATE");
        Expression onUpdateExpression = readExpression();
        column.setOnUpdateExpression(session, onUpdateExpression);
    }
    if (NullConstraintType.NULL_IS_NOT_ALLOWED == parseNotNullConstraint()) {
        column.setNullable(false);
    }
    if (readIf("AUTO_INCREMENT") || readIf("BIGSERIAL") || readIf("SERIAL")) {
        parseAutoIncrement(column);
        parseNotNullConstraint();
    } else if (readIf("IDENTITY")) {
        parseAutoIncrement(column);
        column.setPrimaryKey(true);
        parseNotNullConstraint();
    }
    if (readIf("NULL_TO_DEFAULT")) {
        column.setConvertNullToDefault(true);
    }
    if (readIf("SEQUENCE")) {
        Sequence sequence = readSequence();
        column.setSequence(sequence);
    }
    if (readIf("SELECTIVITY")) {
        int value = readPositiveInt();
        column.setSelectivity(value);
    }
    String comment = readCommentIf();
    if (comment != null) {
        column.setComment(comment);
    }
    return column;
}
Also used : AlterTableRenameColumn(org.h2.command.ddl.AlterTableRenameColumn) AlterTableAlterColumn(org.h2.command.ddl.AlterTableAlterColumn) Column(org.h2.table.Column) ExpressionColumn(org.h2.expression.ExpressionColumn) IndexColumn(org.h2.table.IndexColumn) Expression(org.h2.expression.Expression) ValueExpression(org.h2.expression.ValueExpression) DropSequence(org.h2.command.ddl.DropSequence) CreateSequence(org.h2.command.ddl.CreateSequence) Sequence(org.h2.schema.Sequence) AlterSequence(org.h2.command.dml.AlterSequence) ValueString(org.h2.value.ValueString) AlterTableRenameConstraint(org.h2.command.ddl.AlterTableRenameConstraint) AlterTableAddConstraint(org.h2.command.ddl.AlterTableAddConstraint) AlterTableDropConstraint(org.h2.command.ddl.AlterTableDropConstraint)

Example 15 with Update

use of org.h2.command.dml.Update in project h2database by h2database.

the class Parser method parseMergeUsing.

private MergeUsing parseMergeUsing(Merge oldCommand, int start) {
    MergeUsing command = new MergeUsing(oldCommand);
    currentPrepared = command;
    if (readIf("(")) {
        /* a select query is supplied */
        if (isSelect()) {
            command.setQuery(parseSelect());
            read(")");
        }
        command.setQueryAlias(readFromAlias(null, Collections.singletonList("ON")));
        String[] querySQLOutput = { null };
        List<Column> columnTemplateList = TableView.createQueryColumnTemplateList(null, command.getQuery(), querySQLOutput);
        TableView temporarySourceTableView = createCTEView(command.getQueryAlias(), querySQLOutput[0], columnTemplateList, false, /* no recursion */
        false, /* do not add to session */
        false, /* isPersistent */
        session);
        TableFilter sourceTableFilter = new TableFilter(session, temporarySourceTableView, command.getQueryAlias(), rightsChecked, (Select) command.getQuery(), 0, null);
        command.setSourceTableFilter(sourceTableFilter);
    } else {
        /* Its a table name, simulate a query by building a select query for the table */
        List<String> excludeIdentifiers = Collections.singletonList("ON");
        TableFilter sourceTableFilter = readSimpleTableFilter(0, excludeIdentifiers);
        command.setSourceTableFilter(sourceTableFilter);
        StringBuilder buff = new StringBuilder("SELECT * FROM ");
        appendTableWithSchemaAndAlias(buff, sourceTableFilter.getTable(), sourceTableFilter.getTableAlias());
        Prepared preparedQuery = prepare(session, buff.toString(), null);
        command.setQuery((Select) preparedQuery);
    }
    read("ON");
    read("(");
    Expression condition = readExpression();
    command.setOnCondition(condition);
    read(")");
    if (readIfAll("WHEN", "MATCHED", "THEN")) {
        int startMatched = lastParseIndex;
        if (readIf("UPDATE")) {
            Update updateCommand = new Update(session);
            // currentPrepared = updateCommand;
            TableFilter filter = command.getTargetTableFilter();
            updateCommand.setTableFilter(filter);
            parseUpdateSetClause(updateCommand, filter, startMatched);
            command.setUpdateCommand(updateCommand);
        }
        startMatched = lastParseIndex;
        if (readIf("DELETE")) {
            Delete deleteCommand = new Delete(session);
            TableFilter filter = command.getTargetTableFilter();
            deleteCommand.setTableFilter(filter);
            parseDeleteGivenTable(deleteCommand, null, startMatched);
            command.setDeleteCommand(deleteCommand);
        }
    }
    if (readIfAll("WHEN", "NOT", "MATCHED", "THEN")) {
        if (readIf("INSERT")) {
            Insert insertCommand = new Insert(session);
            insertCommand.setTable(command.getTargetTable());
            parseInsertGivenTable(insertCommand, command.getTargetTable());
            command.setInsertCommand(insertCommand);
        }
    }
    setSQL(command, "MERGE", start);
    // build and prepare the targetMatchQuery ready to test each rows
    // existence in the target table (using source row to match)
    StringBuilder targetMatchQuerySQL = new StringBuilder("SELECT _ROWID_ FROM ");
    appendTableWithSchemaAndAlias(targetMatchQuerySQL, command.getTargetTable(), command.getTargetTableFilter().getTableAlias());
    targetMatchQuerySQL.append(" WHERE ").append(command.getOnCondition().getSQL());
    command.setTargetMatchQuery((Select) parse(targetMatchQuerySQL.toString()));
    return command;
}
Also used : Delete(org.h2.command.dml.Delete) ValueString(org.h2.value.ValueString) Update(org.h2.command.dml.Update) Insert(org.h2.command.dml.Insert) AlterTableRenameConstraint(org.h2.command.ddl.AlterTableRenameConstraint) AlterTableAddConstraint(org.h2.command.ddl.AlterTableAddConstraint) AlterTableDropConstraint(org.h2.command.ddl.AlterTableDropConstraint) AlterTableRenameColumn(org.h2.command.ddl.AlterTableRenameColumn) AlterTableAlterColumn(org.h2.command.ddl.AlterTableAlterColumn) Column(org.h2.table.Column) ExpressionColumn(org.h2.expression.ExpressionColumn) IndexColumn(org.h2.table.IndexColumn) TableFilter(org.h2.table.TableFilter) Expression(org.h2.expression.Expression) ValueExpression(org.h2.expression.ValueExpression) MergeUsing(org.h2.command.dml.MergeUsing) TableView(org.h2.table.TableView)

Aggregations

SQLException (java.sql.SQLException)44 DbException (org.h2.message.DbException)40 Database (org.h2.engine.Database)39 Connection (java.sql.Connection)37 PreparedStatement (java.sql.PreparedStatement)35 Value (org.h2.value.Value)34 ResultSet (java.sql.ResultSet)32 Statement (java.sql.Statement)31 Column (org.h2.table.Column)30 Table (org.h2.table.Table)23 JdbcConnection (org.h2.jdbc.JdbcConnection)22 Expression (org.h2.expression.Expression)19 StatementBuilder (org.h2.util.StatementBuilder)14 ValueExpression (org.h2.expression.ValueExpression)13 ValueString (org.h2.value.ValueString)13 ArrayList (java.util.ArrayList)10 Constraint (org.h2.constraint.Constraint)10 Index (org.h2.index.Index)10 IndexColumn (org.h2.table.IndexColumn)10 Task (org.h2.util.Task)10