All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jooq.impl.UpdateImpl Maven / Gradle / Ivy

There is a newer version: 0.10.0
Show newest version
/**
 * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com)
 * All rights reserved.
 *
 * This work is dual-licensed
 * - under the Apache Software License 2.0 (the "ASL")
 * - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
 * =============================================================================
 * You may choose which license applies to you:
 *
 * - If you're using this work with Open Source databases, you may choose
 *   either ASL or jOOQ License.
 * - If you're using this work with at least one commercial database, you must
 *   choose jOOQ License
 *
 * For more information, please visit http://www.jooq.org/licenses
 *
 * Apache Software License 2.0:
 * -----------------------------------------------------------------------------
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * jOOQ License and Maintenance Agreement:
 * -----------------------------------------------------------------------------
 * Data Geekery grants the Customer the non-exclusive, timely limited and
 * non-transferable license to install and use the Software under the terms of
 * the jOOQ License and Maintenance Agreement.
 *
 * This library is distributed with a LIMITED WARRANTY. See the jOOQ License
 * and Maintenance Agreement for more details: http://www.jooq.org/licensing
 */
package org.jooq.impl;

import static org.jooq.impl.DSL.condition;
import static org.jooq.impl.DSL.exists;
import static org.jooq.impl.DSL.notExists;
import static org.jooq.impl.DSL.table;

import java.util.Collection;
import java.util.Map;

import javax.annotation.Generated;

import org.jooq.Condition;
import org.jooq.Configuration;
import org.jooq.Field;
import org.jooq.Operator;
import org.jooq.QueryPart;
import org.jooq.Record;
import org.jooq.Record1;
import org.jooq.Record10;
import org.jooq.Record11;
import org.jooq.Record12;
import org.jooq.Record13;
import org.jooq.Record14;
import org.jooq.Record15;
import org.jooq.Record16;
import org.jooq.Record17;
import org.jooq.Record18;
import org.jooq.Record19;
import org.jooq.Record2;
import org.jooq.Record20;
import org.jooq.Record21;
import org.jooq.Record22;
import org.jooq.Record3;
import org.jooq.Record4;
import org.jooq.Record5;
import org.jooq.Record6;
import org.jooq.Record7;
import org.jooq.Record8;
import org.jooq.Record9;
import org.jooq.Result;
import org.jooq.Row1;
import org.jooq.Row10;
import org.jooq.Row11;
import org.jooq.Row12;
import org.jooq.Row13;
import org.jooq.Row14;
import org.jooq.Row15;
import org.jooq.Row16;
import org.jooq.Row17;
import org.jooq.Row18;
import org.jooq.Row19;
import org.jooq.Row2;
import org.jooq.Row20;
import org.jooq.Row21;
import org.jooq.Row22;
import org.jooq.Row3;
import org.jooq.Row4;
import org.jooq.Row5;
import org.jooq.Row6;
import org.jooq.Row7;
import org.jooq.Row8;
import org.jooq.Row9;
import org.jooq.Select;
import org.jooq.Table;
import org.jooq.TableLike;
import org.jooq.UpdateConditionStep;
import org.jooq.UpdateFromStep;
import org.jooq.UpdateQuery;
import org.jooq.UpdateResultStep;
import org.jooq.UpdateSetFirstStep;
import org.jooq.UpdateSetMoreStep;
import org.jooq.UpdateWhereStep;

/**
 * A wrapper for an {@link UpdateQuery}
 *
 * @author Lukas Eder
 */
final class UpdateImpl
    extends AbstractDelegatingQuery>
    implements

    // Cascading interface implementations for Update behaviour
    UpdateSetFirstStep,
    UpdateSetMoreStep,
    UpdateConditionStep,
    UpdateResultStep {

    /**
     * Generated UID
     */
    private static final long    serialVersionUID = -2444876472650065331L;

    UpdateImpl(Configuration configuration, Table table) {
        super(new UpdateQueryImpl(configuration, table));
    }

    @Override
    public final  UpdateImpl set(Field field, T value) {
        getDelegate().addValue(field, value);
        return this;
    }

    @Override
    public final  UpdateImpl set(Field field, Field value) {
        getDelegate().addValue(field, value);
        return this;
    }

    @Override
    public final  UpdateImpl set(Field field, Select> value) {
        return set(field, value.asField());
    }

    @Override
    public final UpdateImpl set(Map, ?> map) {
        getDelegate().addValues(map);
        return this;
    }

    @Override
    public final UpdateImpl set(Record record) {
        return set(Utils.map(record));
    }

// [jooq-tools] START [set]

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row1 row, Row1 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row2 row, Row2 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row3 row, Row3 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row4 row, Row4 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row5 row, Row5 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row6 row, Row6 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row7 row, Row7 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row8 row, Row8 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row9 row, Row9 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row10 row, Row10 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row11 row, Row11 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row12 row, Row12 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row13 row, Row13 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row14 row, Row14 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row15 row, Row15 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row16 row, Row16 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row17 row, Row17 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row18 row, Row18 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row19 row, Row19 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row20 row, Row20 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row21 row, Row21 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row22 row, Row22 value) {
        getDelegate().addValues(row, value);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row1 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row2 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row3 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row4 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row5 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row6 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row7 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row8 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row9 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row10 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row11 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row12 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row13 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row14 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row15 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row16 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row17 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row18 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row19 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row20 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row21 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

    @Generated("This method was generated using jOOQ-tools")
    @Override
    public final  UpdateFromStep set(Row22 row, Select> select) {
        getDelegate().addValues(row, select);
        return this;
    }

// [jooq-tools] END [set]

    @Override
    public final UpdateWhereStep from(TableLike table) {
        getDelegate().addFrom(table);
        return this;
    }

    @Override
    public final UpdateWhereStep from(TableLike... tables) {
        getDelegate().addFrom(tables);
        return this;
    }

    @Override
    public final UpdateWhereStep from(Collection> tables) {
        getDelegate().addFrom(tables);
        return this;
    }

    @Override
    public final UpdateWhereStep from(String sql) {
        return from(table(sql));
    }

    @Override
    public final UpdateWhereStep from(String sql, Object... bindings) {
        return from(table(sql, bindings));
    }

    @Override
    public final UpdateWhereStep from(String sql, QueryPart... parts) {
        return from(table(sql, parts));
    }

    @Override
    public final UpdateImpl where(Condition... conditions) {
        getDelegate().addConditions(conditions);
        return this;
    }

    @Override
    public final UpdateImpl where(Collection conditions) {
        getDelegate().addConditions(conditions);
        return this;
    }

    @Override
    public final UpdateImpl where(Field condition) {
        return where(condition(condition));
    }

    @Override
    public final UpdateImpl where(String sql) {
        return where(condition(sql));
    }

    @Override
    public final UpdateImpl where(String sql, Object... bindings) {
        return where(condition(sql, bindings));
    }

    @Override
    public final UpdateImpl where(String sql, QueryPart... parts) {
        return where(condition(sql, parts));
    }

    @Override
    public final UpdateImpl whereExists(Select select) {
        return andExists(select);
    }

    @Override
    public final UpdateImpl whereNotExists(Select select) {
        return andNotExists(select);
    }

    @Override
    public final UpdateImpl and(Condition condition) {
        getDelegate().addConditions(condition);
        return this;
    }

    @Override
    public final UpdateImpl and(Field condition) {
        return and(condition(condition));
    }

    @Override
    public final UpdateImpl and(String sql) {
        return and(condition(sql));
    }

    @Override
    public final UpdateImpl and(String sql, Object... bindings) {
        return and(condition(sql, bindings));
    }

    @Override
    public final UpdateImpl and(String sql, QueryPart... parts) {
        return and(condition(sql, parts));
    }

    @Override
    public final UpdateImpl andNot(Condition condition) {
        return and(condition.not());
    }

    @Override
    public final UpdateImpl andNot(Field condition) {
        return andNot(condition(condition));
    }

    @Override
    public final UpdateImpl andExists(Select select) {
        return and(exists(select));
    }

    @Override
    public final UpdateImpl andNotExists(Select select) {
        return and(notExists(select));
    }

    @Override
    public final UpdateImpl or(Condition condition) {
        getDelegate().addConditions(Operator.OR, condition);
        return this;
    }

    @Override
    public final UpdateImpl or(Field condition) {
        return or(condition(condition));
    }

    @Override
    public final UpdateImpl or(String sql) {
        return or(condition(sql));
    }

    @Override
    public final UpdateImpl or(String sql, Object... bindings) {
        return or(condition(sql, bindings));
    }

    @Override
    public final UpdateImpl or(String sql, QueryPart... parts) {
        return or(condition(sql, parts));
    }

    @Override
    public final UpdateImpl orNot(Condition condition) {
        return or(condition.not());
    }

    @Override
    public final UpdateImpl orNot(Field condition) {
        return orNot(condition(condition));
    }

    @Override
    public final UpdateImpl orExists(Select select) {
        return or(exists(select));
    }

    @Override
    public final UpdateImpl orNotExists(Select select) {
        return or(notExists(select));
    }

    @Override
    public final UpdateImpl returning() {
        getDelegate().setReturning();
        return this;
    }

    @Override
    public final UpdateImpl returning(Field... f) {
        getDelegate().setReturning(f);
        return this;
    }

    @Override
    public final UpdateImpl returning(Collection> f) {
        getDelegate().setReturning(f);
        return this;
    }

    @Override
    public final Result fetch() {
        getDelegate().execute();
        return getDelegate().getReturnedRecords();
    }

    @Override
    public final R fetchOne() {
        getDelegate().execute();
        return getDelegate().getReturnedRecord();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy