[jOOQ/jOOQ#13640] Add RowEq, RowNe, RowGt, RowGe, RowLt, RowLe

This includes:

- [#12907] Add a QOM.UConvertibleOperator utility with methods like ()
This commit is contained in:
Lukas Eder 2023-01-26 13:54:48 +01:00
parent 3ce91d5f50
commit 4d45feeacc
34 changed files with 1293 additions and 57 deletions

View File

@ -43,6 +43,7 @@ import static org.jooq.Clause.FIELD_ROW;
import static org.jooq.impl.Keywords.K_ROW;
import static org.jooq.impl.Names.N_ROW;
import static org.jooq.impl.QueryPartListView.wrap;
import static org.jooq.impl.Tools.nullSafe;
import java.util.Collection;
import java.util.function.Function;
@ -51,6 +52,7 @@ import java.util.stream.Stream;
import org.jooq.Binding;
import org.jooq.Clause;
import org.jooq.Comment;
import org.jooq.Comparator;
import org.jooq.Condition;
import org.jooq.Configuration;
import org.jooq.Context;
@ -60,10 +62,12 @@ import org.jooq.Field;
import org.jooq.Name;
import org.jooq.QueryPart;
import org.jooq.Record;
import org.jooq.Record1;
// ...
import org.jooq.Row;
import org.jooq.Row1;
import org.jooq.Row2;
import org.jooq.Select;
import org.jooq.ContextConverter;
import org.jooq.SelectField;
// ...
@ -260,6 +264,29 @@ abstract class AbstractRow<R extends Record> extends AbstractQueryPart implement
// XXX: Row accessor API
// ------------------------------------------------------------------------
static final Condition compare(Row arg1, Comparator comparator, Row arg2) {
switch (comparator) {
case EQUALS:
return new RowEq(arg1, arg2);
case GREATER:
return new RowGt(arg1, arg2);
case GREATER_OR_EQUAL:
return new RowGe(arg1, arg2);
case LESS:
return new RowLt(arg1, arg2);
case LESS_OR_EQUAL:
return new RowLe(arg1, arg2);
case NOT_EQUALS:
return new RowNe(arg1, arg2);
}
throw new IllegalArgumentException("Comparator not supported: " + comparator);
}
final Condition compare(Comparator comparator, Row row) {
return compare(this, comparator, row);
}
@Override
public final int size() {
return fields.size();

View File

@ -6636,7 +6636,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
: isField
? ((Field) left).compare(comp, toField(parseConcat()))
: new RowCondition((Row) left, parseRow(((Row) left).size(), true), comp);
: AbstractRow.compare((Row) left, comp, parseRow(((Row) left).size(), true));
if (all || any)
parse(')');

View File

@ -2790,10 +2790,9 @@ public final class QOM {
//permits
// Ge
{
@SuppressWarnings("unchecked")
@Override
default Le<T> $converse() {
return (Le<T>) $arg2().le($arg1());
return new org.jooq.impl.Le<>($arg2(), $arg1());
}
}
@ -2808,10 +2807,9 @@ public final class QOM {
//permits
// Gt
{
@SuppressWarnings("unchecked")
@Override
default Lt<T> $converse() {
return (Lt<T>) $arg2().lt($arg1());
return new org.jooq.impl.Lt<>($arg2(), $arg1());
}
}
@ -2899,10 +2897,9 @@ public final class QOM {
//permits
// Le
{
@SuppressWarnings("unchecked")
@Override
default Ge<T> $converse() {
return (Ge<T>) $arg2().ge($arg1());
return new org.jooq.impl.Ge<>($arg2(), $arg1());
}
}
@ -2968,10 +2965,9 @@ public final class QOM {
//permits
// Lt
{
@SuppressWarnings("unchecked")
@Override
default Gt<T> $converse() {
return (Gt<T>) $arg2().gt($arg1());
return new org.jooq.impl.Gt<>($arg2(), $arg1());
}
}
@ -3183,6 +3179,98 @@ public final class QOM {
// Xor
{}
/**
* The <code>ROW EQ</code> operator.
*/
public /*sealed*/ interface RowEq
extends
UReturnsNullOnNullInput,
UCommutativeOperator<Row, RowEq>,
org.jooq.Condition
//permits
// RowEq
{}
/**
* The <code>ROW NE</code> operator.
*/
public /*sealed*/ interface RowNe
extends
UReturnsNullOnNullInput,
UCommutativeOperator<Row, RowNe>,
org.jooq.Condition
//permits
// RowNe
{}
/**
* The <code>ROW GT</code> operator.
*/
public /*sealed*/ interface RowGt
extends
UReturnsNullOnNullInput,
UConvertibleOperator<Row, RowGt, RowLt>,
org.jooq.Condition
//permits
// RowGt
{
@Override
default RowLt $converse() {
return new org.jooq.impl.RowLt($arg2(), $arg1());
}
}
/**
* The <code>ROW GE</code> operator.
*/
public /*sealed*/ interface RowGe
extends
UReturnsNullOnNullInput,
UConvertibleOperator<Row, RowGe, RowLe>,
org.jooq.Condition
//permits
// RowGe
{
@Override
default RowLe $converse() {
return new org.jooq.impl.RowLe($arg2(), $arg1());
}
}
/**
* The <code>ROW LT</code> operator.
*/
public /*sealed*/ interface RowLt
extends
UReturnsNullOnNullInput,
UConvertibleOperator<Row, RowLt, RowGt>,
org.jooq.Condition
//permits
// RowLt
{
@Override
default RowGt $converse() {
return new org.jooq.impl.RowGt($arg2(), $arg1());
}
}
/**
* The <code>ROW LE</code> operator.
*/
public /*sealed*/ interface RowLe
extends
UReturnsNullOnNullInput,
UConvertibleOperator<Row, RowLe, RowGe>,
org.jooq.Condition
//permits
// RowLe
{
@Override
default RowGe $converse() {
return new org.jooq.impl.RowGe($arg2(), $arg1());
}
}
/**
* The <code>IS DOCUMENT</code> operator.
* <p>

View File

@ -698,7 +698,7 @@ implements
// These dialects either don't support row value expressions, or they
// Can't handle row value expressions with the BETWEEN predicate
else if (row.size() > 1 && EMULATE_BETWEEN.contains(ctx.dialect())) {
Condition result = new RowCondition(row, minValue, Comparator.GREATER_OR_EQUAL).and(new RowCondition(row, maxValue, Comparator.LESS_OR_EQUAL));
Condition result = AbstractRow.compare(row, Comparator.GREATER_OR_EQUAL, minValue).and(AbstractRow.compare(row, Comparator.LESS_OR_EQUAL, maxValue));
if (not)
result = result.not();

View File

@ -0,0 +1,321 @@
/*
* 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.*;
import static org.jooq.impl.Internal.*;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Names.*;
import static org.jooq.impl.SQLDataType.*;
import static org.jooq.impl.Tools.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.impl.Tools.ExtendedDataKey.*;
import static org.jooq.impl.Tools.SimpleDataKey.*;
import static org.jooq.SQLDialect.*;
import org.jooq.*;
import org.jooq.Function1;
import org.jooq.Record;
import org.jooq.conf.*;
import org.jooq.impl.*;
import org.jooq.impl.QOM.*;
import org.jooq.tools.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* The <code>ROW EQ</code> statement.
*/
@SuppressWarnings({ "unused" })
final class RowEq
extends
AbstractCondition
implements
QOM.RowEq
{
final Row arg1;
final Row arg2;
RowEq(
Row arg1,
Row arg2
) {
this.arg1 = ((AbstractRow) arg1).convertTo(arg2);
this.arg2 = ((AbstractRow) arg2).convertTo(arg1);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
private static final Set<SQLDialect> EMULATE_EQ_AND_NE = SQLDialect.supportedBy(DERBY, FIREBIRD);
private static final Set<SQLDialect> EMULATE_RANGES = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD);
@Override
public final void accept(Context<?> ctx) {
RowEq.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.EQUALS, arg2);
}
/**
* @deprecated - [#12425] After the QOM refactoring, this should be improved
*/
@Deprecated
static final <T extends Row> void acceptCompareCondition(
Context<?> ctx,
AbstractCondition condition,
T arg1,
org.jooq.Comparator op,
T arg2
) {
// Regular comparison predicate emulation
if ((op == org.jooq.Comparator.EQUALS || op == org.jooq.Comparator.NOT_EQUALS) &&
// TODO: Re-implement Informix forceEmulation semantics
EMULATE_EQ_AND_NE.contains(ctx.dialect())
) {
Field<?>[] arg2Fields = arg2.fields();
Condition result = DSL.and(map(arg1.fields(), (f, i) -> f.equal((Field) arg2Fields[i])));
if (op == org.jooq.Comparator.NOT_EQUALS)
result = result.not();
ctx.visit(result);
}
// Ordering comparison predicate emulation
else if ((op == org.jooq.Comparator.GREATER || op == org.jooq.Comparator.GREATER_OR_EQUAL || op == org.jooq.Comparator.LESS || op == org.jooq.Comparator.LESS_OR_EQUAL) &&
// TODO: Re-implement Informix forceEmulation semantics
EMULATE_RANGES.contains(ctx.dialect())
) {
// The order component of the comparator (stripping the equal component)
org.jooq.Comparator order
= (op == org.jooq.Comparator.GREATER) ? org.jooq.Comparator.GREATER
: (op == org.jooq.Comparator.GREATER_OR_EQUAL) ? org.jooq.Comparator.GREATER
: (op == org.jooq.Comparator.LESS) ? org.jooq.Comparator.LESS
: (op == org.jooq.Comparator.LESS_OR_EQUAL) ? org.jooq.Comparator.LESS
: null;
// [#2658] The factored order component of the comparator (enforcing the equal component)
org.jooq.Comparator factoredOrder
= (op == org.jooq.Comparator.GREATER) ? org.jooq.Comparator.GREATER_OR_EQUAL
: (op == org.jooq.Comparator.GREATER_OR_EQUAL) ? org.jooq.Comparator.GREATER_OR_EQUAL
: (op == org.jooq.Comparator.LESS) ? org.jooq.Comparator.LESS_OR_EQUAL
: (op == org.jooq.Comparator.LESS_OR_EQUAL) ? org.jooq.Comparator.LESS_OR_EQUAL
: null;
// Whether the comparator has an equal component
boolean equal
= (op == org.jooq.Comparator.GREATER_OR_EQUAL)
||(op == org.jooq.Comparator.LESS_OR_EQUAL);
Field<?>[] arg1Fields = arg1.fields();
Field<?>[] arg2Fields = arg2.fields();
// The following algorithm emulates the equivalency of these expressions:
// (A, B, C) > (X, Y, Z)
// (A > X) OR (A = X AND B > Y) OR (A = X AND B = Y AND C > Z)
List<Condition> outer = new ArrayList<>(1 + arg1Fields.length);
for (int i = 0; i < arg1Fields.length; i++) {
List<Condition> inner = new ArrayList<>(1 + i);
for (int j = 0; j < i; j++)
inner.add(arg1Fields[j].equal((Field) arg2Fields[j]));
inner.add(arg1Fields[i].compare(
equal && i == arg1Fields.length - 1 ? op : order,
(Field) arg2Fields[i])
);
outer.add(DSL.and(inner));
}
Condition result = DSL.or(outer);
// [#2658] For performance reasons, an additional, redundant
// predicate is factored out to favour the application of range
// scans as the topmost predicate is AND-connected, not
// OR-connected:
// (A, B, C) > (X, Y, Z)
// (A >= X) AND ((A > X) OR (A = X AND B > Y) OR (A = X AND B = Y AND C > Z))
if (arg1Fields.length > 1)
result = arg1Fields[0].compare(factoredOrder, (Field) arg2Fields[0]).and(result);
ctx.visit(result);
}
else {
// Some dialects do not support != comparison with rows
{
// Some databases need extra parentheses around the RHS
boolean extraParentheses = false
;
ctx.visit(arg1)
.sql(' ')
.sql(op.toSQL())
.sql(' ')
.sql(extraParentheses ? "(" : "")
.visit(arg2)
.sql(extraParentheses ? ")" : "");
}
}
}
/**
* @deprecated - [#12425] After the QOM refactoring, this should be improved
*/
@Deprecated
static final org.jooq.Comparator comparator(Condition condition) {
if (condition instanceof RowEq)
return org.jooq.Comparator.EQUALS;
else if (condition instanceof RowNe)
return org.jooq.Comparator.NOT_EQUALS;
else if (condition instanceof RowGt)
return org.jooq.Comparator.GREATER;
else if (condition instanceof RowGe)
return org.jooq.Comparator.GREATER_OR_EQUAL;
else if (condition instanceof RowLt)
return org.jooq.Comparator.LESS;
else if (condition instanceof RowLe)
return org.jooq.Comparator.LESS_OR_EQUAL;
else
return null;
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------
@Override
public final Row $arg1() {
return arg1;
}
@Override
public final Row $arg2() {
return arg2;
}
@Override
public final QOM.RowEq $arg1(Row newValue) {
return $constructor().apply(newValue, $arg2());
}
@Override
public final QOM.RowEq $arg2(Row newValue) {
return $constructor().apply($arg1(), newValue);
}
@Override
public final Function2<? super Row, ? super Row, ? extends QOM.RowEq> $constructor() {
return (a1, a2) -> new RowEq(a1, a2);
}
// -------------------------------------------------------------------------
// XXX: The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof QOM.RowEq o) {
return
StringUtils.equals($arg1(), o.$arg1()) &&
StringUtils.equals($arg2(), o.$arg2())
;
}
else
return super.equals(that);
}
}

View File

@ -0,0 +1,160 @@
/*
* 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.*;
import static org.jooq.impl.Internal.*;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Names.*;
import static org.jooq.impl.SQLDataType.*;
import static org.jooq.impl.Tools.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.impl.Tools.ExtendedDataKey.*;
import static org.jooq.impl.Tools.SimpleDataKey.*;
import static org.jooq.SQLDialect.*;
import org.jooq.*;
import org.jooq.Function1;
import org.jooq.Record;
import org.jooq.conf.*;
import org.jooq.impl.*;
import org.jooq.impl.QOM.*;
import org.jooq.tools.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* The <code>ROW GE</code> statement.
*/
@SuppressWarnings({ "unused" })
final class RowGe
extends
AbstractCondition
implements
QOM.RowGe
{
final Row arg1;
final Row arg2;
RowGe(
Row arg1,
Row arg2
) {
this.arg1 = ((AbstractRow) arg1).convertTo(arg2);
this.arg2 = ((AbstractRow) arg2).convertTo(arg1);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
RowEq.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.GREATER_OR_EQUAL, arg2);
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------
@Override
public final Row $arg1() {
return arg1;
}
@Override
public final Row $arg2() {
return arg2;
}
@Override
public final QOM.RowGe $arg1(Row newValue) {
return $constructor().apply(newValue, $arg2());
}
@Override
public final QOM.RowGe $arg2(Row newValue) {
return $constructor().apply($arg1(), newValue);
}
@Override
public final Function2<? super Row, ? super Row, ? extends QOM.RowGe> $constructor() {
return (a1, a2) -> new RowGe(a1, a2);
}
// -------------------------------------------------------------------------
// XXX: The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof QOM.RowGe o) {
return
StringUtils.equals($arg1(), o.$arg1()) &&
StringUtils.equals($arg2(), o.$arg2())
;
}
else
return super.equals(that);
}
}

View File

@ -0,0 +1,160 @@
/*
* 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.*;
import static org.jooq.impl.Internal.*;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Names.*;
import static org.jooq.impl.SQLDataType.*;
import static org.jooq.impl.Tools.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.impl.Tools.ExtendedDataKey.*;
import static org.jooq.impl.Tools.SimpleDataKey.*;
import static org.jooq.SQLDialect.*;
import org.jooq.*;
import org.jooq.Function1;
import org.jooq.Record;
import org.jooq.conf.*;
import org.jooq.impl.*;
import org.jooq.impl.QOM.*;
import org.jooq.tools.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* The <code>ROW GT</code> statement.
*/
@SuppressWarnings({ "unused" })
final class RowGt
extends
AbstractCondition
implements
QOM.RowGt
{
final Row arg1;
final Row arg2;
RowGt(
Row arg1,
Row arg2
) {
this.arg1 = ((AbstractRow) arg1).convertTo(arg2);
this.arg2 = ((AbstractRow) arg2).convertTo(arg1);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
RowEq.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.GREATER, arg2);
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------
@Override
public final Row $arg1() {
return arg1;
}
@Override
public final Row $arg2() {
return arg2;
}
@Override
public final QOM.RowGt $arg1(Row newValue) {
return $constructor().apply(newValue, $arg2());
}
@Override
public final QOM.RowGt $arg2(Row newValue) {
return $constructor().apply($arg1(), newValue);
}
@Override
public final Function2<? super Row, ? super Row, ? extends QOM.RowGt> $constructor() {
return (a1, a2) -> new RowGt(a1, a2);
}
// -------------------------------------------------------------------------
// XXX: The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof QOM.RowGt o) {
return
StringUtils.equals($arg1(), o.$arg1()) &&
StringUtils.equals($arg2(), o.$arg2())
;
}
else
return super.equals(that);
}
}

View File

@ -108,12 +108,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row1<T1> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record1<T1> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -153,12 +153,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -158,12 +158,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -163,12 +163,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -168,12 +168,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -173,12 +173,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -178,12 +178,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -183,12 +183,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -188,12 +188,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -193,12 +193,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -198,12 +198,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -113,12 +113,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row2<T1, T2> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record2<T1, T2> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -203,12 +203,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -208,12 +208,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -213,12 +213,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -118,12 +118,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row3<T1, T2, T3> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record3<T1, T2, T3> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -123,12 +123,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row4<T1, T2, T3, T4> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record4<T1, T2, T3, T4> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -128,12 +128,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row5<T1, T2, T3, T4, T5> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record5<T1, T2, T3, T4, T5> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -133,12 +133,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row6<T1, T2, T3, T4, T5, T6> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record6<T1, T2, T3, T4, T5, T6> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -138,12 +138,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row7<T1, T2, T3, T4, T5, T6, T7> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record7<T1, T2, T3, T4, T5, T6, T7> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -143,12 +143,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row8<T1, T2, T3, T4, T5, T6, T7, T8> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record8<T1, T2, T3, T4, T5, T6, T7, T8> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -148,12 +148,12 @@ implements
@Override
public final Condition compare(Comparator comparator, Row9<T1, T2, T3, T4, T5, T6, T7, T8, T9> row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record9<T1, T2, T3, T4, T5, T6, T7, T8, T9> record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -100,12 +100,12 @@ implements
@Override
public final Condition compare(Comparator comparator, RowN row) {
return new RowCondition(this, row, comparator);
return compare(this, comparator, row);
}
@Override
public final Condition compare(Comparator comparator, Record record) {
return new RowCondition(this, record.valuesRow(), comparator);
return compare(this, comparator, record.valuesRow());
}
@Override

View File

@ -101,7 +101,7 @@ final class RowInCondition extends AbstractCondition implements UNotYetImplement
@Override
public final void accept(Context<?> ctx) {
if (EMULATE_IN.contains(ctx.dialect())) {
Condition result = DSL.or(map(right, r -> new RowCondition(left, r, EQUALS)));
Condition result = DSL.or(map(right, r -> AbstractRow.compare(left, EQUALS, r)));
if (not)
result = result.not();

View File

@ -0,0 +1,160 @@
/*
* 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.*;
import static org.jooq.impl.Internal.*;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Names.*;
import static org.jooq.impl.SQLDataType.*;
import static org.jooq.impl.Tools.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.impl.Tools.ExtendedDataKey.*;
import static org.jooq.impl.Tools.SimpleDataKey.*;
import static org.jooq.SQLDialect.*;
import org.jooq.*;
import org.jooq.Function1;
import org.jooq.Record;
import org.jooq.conf.*;
import org.jooq.impl.*;
import org.jooq.impl.QOM.*;
import org.jooq.tools.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* The <code>ROW LE</code> statement.
*/
@SuppressWarnings({ "unused" })
final class RowLe
extends
AbstractCondition
implements
QOM.RowLe
{
final Row arg1;
final Row arg2;
RowLe(
Row arg1,
Row arg2
) {
this.arg1 = ((AbstractRow) arg1).convertTo(arg2);
this.arg2 = ((AbstractRow) arg2).convertTo(arg1);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
RowEq.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.LESS_OR_EQUAL, arg2);
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------
@Override
public final Row $arg1() {
return arg1;
}
@Override
public final Row $arg2() {
return arg2;
}
@Override
public final QOM.RowLe $arg1(Row newValue) {
return $constructor().apply(newValue, $arg2());
}
@Override
public final QOM.RowLe $arg2(Row newValue) {
return $constructor().apply($arg1(), newValue);
}
@Override
public final Function2<? super Row, ? super Row, ? extends QOM.RowLe> $constructor() {
return (a1, a2) -> new RowLe(a1, a2);
}
// -------------------------------------------------------------------------
// XXX: The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof QOM.RowLe o) {
return
StringUtils.equals($arg1(), o.$arg1()) &&
StringUtils.equals($arg2(), o.$arg2())
;
}
else
return super.equals(that);
}
}

View File

@ -0,0 +1,160 @@
/*
* 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.*;
import static org.jooq.impl.Internal.*;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Names.*;
import static org.jooq.impl.SQLDataType.*;
import static org.jooq.impl.Tools.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.impl.Tools.ExtendedDataKey.*;
import static org.jooq.impl.Tools.SimpleDataKey.*;
import static org.jooq.SQLDialect.*;
import org.jooq.*;
import org.jooq.Function1;
import org.jooq.Record;
import org.jooq.conf.*;
import org.jooq.impl.*;
import org.jooq.impl.QOM.*;
import org.jooq.tools.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* The <code>ROW LT</code> statement.
*/
@SuppressWarnings({ "unused" })
final class RowLt
extends
AbstractCondition
implements
QOM.RowLt
{
final Row arg1;
final Row arg2;
RowLt(
Row arg1,
Row arg2
) {
this.arg1 = ((AbstractRow) arg1).convertTo(arg2);
this.arg2 = ((AbstractRow) arg2).convertTo(arg1);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
RowEq.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.LESS, arg2);
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------
@Override
public final Row $arg1() {
return arg1;
}
@Override
public final Row $arg2() {
return arg2;
}
@Override
public final QOM.RowLt $arg1(Row newValue) {
return $constructor().apply(newValue, $arg2());
}
@Override
public final QOM.RowLt $arg2(Row newValue) {
return $constructor().apply($arg1(), newValue);
}
@Override
public final Function2<? super Row, ? super Row, ? extends QOM.RowLt> $constructor() {
return (a1, a2) -> new RowLt(a1, a2);
}
// -------------------------------------------------------------------------
// XXX: The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof QOM.RowLt o) {
return
StringUtils.equals($arg1(), o.$arg1()) &&
StringUtils.equals($arg2(), o.$arg2())
;
}
else
return super.equals(that);
}
}

View File

@ -0,0 +1,160 @@
/*
* 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.*;
import static org.jooq.impl.Internal.*;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Names.*;
import static org.jooq.impl.SQLDataType.*;
import static org.jooq.impl.Tools.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.impl.Tools.ExtendedDataKey.*;
import static org.jooq.impl.Tools.SimpleDataKey.*;
import static org.jooq.SQLDialect.*;
import org.jooq.*;
import org.jooq.Function1;
import org.jooq.Record;
import org.jooq.conf.*;
import org.jooq.impl.*;
import org.jooq.impl.QOM.*;
import org.jooq.tools.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* The <code>ROW NE</code> statement.
*/
@SuppressWarnings({ "unused" })
final class RowNe
extends
AbstractCondition
implements
QOM.RowNe
{
final Row arg1;
final Row arg2;
RowNe(
Row arg1,
Row arg2
) {
this.arg1 = ((AbstractRow) arg1).convertTo(arg2);
this.arg2 = ((AbstractRow) arg2).convertTo(arg1);
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
RowEq.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.NOT_EQUALS, arg2);
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------
@Override
public final Row $arg1() {
return arg1;
}
@Override
public final Row $arg2() {
return arg2;
}
@Override
public final QOM.RowNe $arg1(Row newValue) {
return $constructor().apply(newValue, $arg2());
}
@Override
public final QOM.RowNe $arg2(Row newValue) {
return $constructor().apply($arg1(), newValue);
}
@Override
public final Function2<? super Row, ? super Row, ? extends QOM.RowNe> $constructor() {
return (a1, a2) -> new RowNe(a1, a2);
}
// -------------------------------------------------------------------------
// XXX: The Object API
// -------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (that instanceof QOM.RowNe o) {
return
StringUtils.equals($arg1(), o.$arg1()) &&
StringUtils.equals($arg2(), o.$arg2())
;
}
else
return super.equals(that);
}
}