Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.jooq.impl.UpdateImpl Maven / Gradle / Ivy
/*
* 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
*
* https://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.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: https://www.jooq.org/legal/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 static org.jooq.impl.Tools.map;
import java.util.Collection;
import java.util.Map;
import org.jooq.Condition;
import org.jooq.Configuration;
import org.jooq.Field;
import org.jooq.FieldOrRow;
import org.jooq.FieldOrRowOrSelect;
import org.jooq.Name;
import org.jooq.Operator;
import org.jooq.OrderField;
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.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.RowN;
import org.jooq.SQL;
import org.jooq.Select;
import org.jooq.SelectField;
import org.jooq.SelectFieldOrAsterisk;
import org.jooq.SortField;
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;
import org.jooq.impl.QOM.UnmodifiableList;
import org.jooq.impl.QOM.UnmodifiableMap;
import org.jooq.impl.QOM.Update;
import org.jooq.impl.QOM.With;
/**
* A wrapper for an {@link UpdateQuery}
*
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class UpdateImpl
extends
AbstractDelegatingDMLQuery>
implements
// Cascading interface implementations for Update behaviour
UpdateSetFirstStep,
UpdateSetMoreStep,
UpdateConditionStep,
QOM.Update
{
private boolean returningResult;
UpdateImpl(Configuration configuration, WithImpl with, Table table) {
super(new UpdateQueryImpl<>(configuration, with, 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 extends Record1> value) {
if (value == null)
return set(field, (T) null);
else
return set(field, value.asField());
}
@Override
public final UpdateImpl setNull(Field field) {
return set(field, (T) null);
}
@Override
public final UpdateImpl set(Map, ?> map) {
getDelegate().addValues(map);
return this;
}
@Override
public final UpdateImpl set(Record record) {
return set(Tools.mapOfChangedValues(record));
}
@Override
public final UpdateFromStep set(RowN row, RowN value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row1 row, Row1 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row2 row, Row2 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row3 row, Row3 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row4 row, Row4 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row5 row, Row5 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row6 row, Row6 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row7 row, Row7 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row8 row, Row8 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row9 row, Row9 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row10 row, Row10 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row11 row, Row11 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row12 row, Row12 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row13 row, Row13 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row14 row, Row14 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row15 row, Row15 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row16 row, Row16 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row17 row, Row17 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row18 row, Row18 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row19 row, Row19 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row20 row, Row20 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row21 row, Row21 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(Row22 row, Row22 value) {
getDelegate().addValues(row, value);
return this;
}
@Override
public final UpdateFromStep set(RowN row, Select extends Record> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row1 row, Select extends Record1> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row2 row, Select extends Record2> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row3 row, Select extends Record3> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row4 row, Select extends Record4> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row5 row, Select extends Record5> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row6 row, Select extends Record6> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row7 row, Select extends Record7> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row8 row, Select extends Record8> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row9 row, Select extends Record9> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row10 row, Select extends Record10> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row11 row, Select extends Record11> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row12 row, Select extends Record12> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row13 row, Select extends Record13> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row14 row, Select extends Record14> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row15 row, Select extends Record15> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row16 row, Select extends Record16> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row17 row, Select extends Record17> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row18 row, Select extends Record18> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row19 row, Select extends Record19> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row20 row, Select extends Record20> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row21 row, Select extends Record21> select) {
getDelegate().addValues(row, select);
return this;
}
@Override
public final UpdateFromStep set(Row22 row, Select extends Record22> select) {
getDelegate().addValues(row, select);
return this;
}
@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 extends TableLike>> tables) {
getDelegate().addFrom(tables);
return this;
}
@Override
public final UpdateWhereStep from(SQL sql) {
return from(table(sql));
}
@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 UpdateWhereStep from(Name name) {
return from(table(name));
}
@Override
public final UpdateImpl where(Condition conditions) {
getDelegate().addConditions(conditions);
return this;
}
@Override
public final UpdateImpl where(Condition... conditions) {
getDelegate().addConditions(conditions);
return this;
}
@Override
public final UpdateImpl where(Collection extends Condition> conditions) {
getDelegate().addConditions(conditions);
return this;
}
@Override
public final UpdateImpl where(Field condition) {
return where(condition(condition));
}
@Override
public final UpdateImpl where(SQL sql) {
return where(condition(sql));
}
@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(SQL sql) {
return and(condition(sql));
}
@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(SQL sql) {
return or(condition(sql));
}
@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 orderBy(OrderField>... fields) {
getDelegate().addOrderBy(fields);
return this;
}
@Override
public final UpdateImpl orderBy(Collection extends OrderField>> fields) {
getDelegate().addOrderBy(fields);
return this;
}
@Override
public final UpdateImpl orderBy(int... fieldIndexes) {
return orderBy(map(fieldIndexes, v -> DSL.inline(v)));
}
@Override
public final UpdateImpl limit(Number limit) {
getDelegate().addLimit(limit);
return this;
}
@Override
public final UpdateImpl limit(Field extends Number> limit) {
getDelegate().addLimit(limit);
return this;
}
@Override
public final UpdateResultStep returning() {
getDelegate().setReturning();
return new UpdateAsResultQuery<>(getDelegate(), returningResult);
}
@Override
public final UpdateResultStep returning(SelectFieldOrAsterisk... f) {
getDelegate().setReturning(f);
return new UpdateAsResultQuery<>(getDelegate(), returningResult);
}
@Override
public final UpdateResultStep