[jOOQ/jOOQ#13640] Move QuantifiedComparisonCondition to QOM API
- Refactored it into individual types (e.g. EqQuantified, NeQuantified) - Fix a regression in Array caused by [jOOQ/jOOQ#14560]
This commit is contained in:
parent
ac48cb7ad5
commit
097f26e0d1
@ -660,6 +660,13 @@ extends
|
||||
@Support
|
||||
Condition eq(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>EQ</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition eq(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>EQUAL</code> operator, an alias for the <code>EQ</code> operator.
|
||||
*/
|
||||
@ -681,6 +688,13 @@ extends
|
||||
@Support
|
||||
Condition equal(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>EQUAL</code> operator, an alias for the <code>EQ</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition equal(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>GE</code> operator.
|
||||
*/
|
||||
@ -702,6 +716,13 @@ extends
|
||||
@Support
|
||||
Condition ge(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>GE</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition ge(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>GREATER_OR_EQUAL</code> operator, an alias for the <code>GE</code> operator.
|
||||
*/
|
||||
@ -723,6 +744,13 @@ extends
|
||||
@Support
|
||||
Condition greaterOrEqual(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>GREATER_OR_EQUAL</code> operator, an alias for the <code>GE</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition greaterOrEqual(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>GREATER_THAN</code> operator, an alias for the <code>GT</code> operator.
|
||||
*/
|
||||
@ -744,6 +772,13 @@ extends
|
||||
@Support
|
||||
Condition greaterThan(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>GREATER_THAN</code> operator, an alias for the <code>GT</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition greaterThan(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>GT</code> operator.
|
||||
*/
|
||||
@ -765,6 +800,13 @@ extends
|
||||
@Support
|
||||
Condition gt(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>GT</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition gt(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>IN</code> operator.
|
||||
* <p>
|
||||
@ -871,6 +913,13 @@ extends
|
||||
@Support
|
||||
Condition le(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>LE</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition le(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>LESS_OR_EQUAL</code> operator, an alias for the <code>LE</code> operator.
|
||||
*/
|
||||
@ -892,6 +941,13 @@ extends
|
||||
@Support
|
||||
Condition lessOrEqual(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>LESS_OR_EQUAL</code> operator, an alias for the <code>LE</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition lessOrEqual(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>LESS_THAN</code> operator, an alias for the <code>LT</code> operator.
|
||||
*/
|
||||
@ -913,6 +969,13 @@ extends
|
||||
@Support
|
||||
Condition lessThan(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>LESS_THAN</code> operator, an alias for the <code>LT</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition lessThan(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>LIKE</code> operator.
|
||||
*
|
||||
@ -929,6 +992,13 @@ extends
|
||||
@Support
|
||||
LikeEscapeStep like(Field<String> pattern);
|
||||
|
||||
/**
|
||||
* The <code>LIKE</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
LikeEscapeStep like(org.jooq.QuantifiedSelect<? extends Record1<String>> pattern);
|
||||
|
||||
/**
|
||||
* The <code>LIKE_IGNORE_CASE</code> operator.
|
||||
* <p>
|
||||
@ -980,6 +1050,13 @@ extends
|
||||
@Support
|
||||
Condition lt(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>LT</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition lt(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>NE</code> operator.
|
||||
*/
|
||||
@ -1001,6 +1078,13 @@ extends
|
||||
@Support
|
||||
Condition ne(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>NE</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition ne(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>NOT_EQUAL</code> operator, an alias for the <code>NE</code> operator.
|
||||
*/
|
||||
@ -1022,6 +1106,13 @@ extends
|
||||
@Support
|
||||
Condition notEqual(Field<T> arg2);
|
||||
|
||||
/**
|
||||
* The <code>NOT_EQUAL</code> operator, an alias for the <code>NE</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition notEqual(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2);
|
||||
|
||||
/**
|
||||
* The <code>NOT_IN</code> operator.
|
||||
* <p>
|
||||
@ -1053,6 +1144,13 @@ extends
|
||||
@Support
|
||||
LikeEscapeStep notLike(Field<String> pattern);
|
||||
|
||||
/**
|
||||
* The <code>NOT_LIKE</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
LikeEscapeStep notLike(org.jooq.QuantifiedSelect<? extends Record1<String>> pattern);
|
||||
|
||||
/**
|
||||
* The <code>NOT_LIKE_IGNORE_CASE</code> operator.
|
||||
* <p>
|
||||
@ -1099,6 +1197,13 @@ extends
|
||||
@Support
|
||||
LikeEscapeStep notSimilarTo(Field<String> pattern);
|
||||
|
||||
/**
|
||||
* The <code>NOT_SIMILAR_TO</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
LikeEscapeStep notSimilarTo(org.jooq.QuantifiedSelect<? extends Record1<String>> pattern);
|
||||
|
||||
/**
|
||||
* The <code>SIMILAR_TO</code> operator.
|
||||
*
|
||||
@ -1115,6 +1220,13 @@ extends
|
||||
@Support
|
||||
LikeEscapeStep similarTo(Field<String> pattern);
|
||||
|
||||
/**
|
||||
* The <code>SIMILAR_TO</code> operator.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
LikeEscapeStep similarTo(org.jooq.QuantifiedSelect<? extends Record1<String>> pattern);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XML predicates
|
||||
// -------------------------------------------------------------------------
|
||||
@ -2174,26 +2286,6 @@ extends
|
||||
@Support
|
||||
Condition like(String value, char escape);
|
||||
|
||||
/**
|
||||
* Create a condition to pattern-check this field against a quantified select.
|
||||
* <p>
|
||||
* For example a query like {@code field.like(any("a%", "b%"))} translates into
|
||||
* the SQL {@code (field like 'a%' or field like 'b%')}.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Field...)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Field...)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
* @see LikeEscapeStep#escape(char)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
LikeEscapeStep like(QuantifiedSelect<Record1<String>> query);
|
||||
|
||||
/**
|
||||
* Create a condition to case-insensitively pattern-check this field against
|
||||
* a field.
|
||||
@ -2244,26 +2336,6 @@ extends
|
||||
@Support
|
||||
Condition notLike(String value, char escape);
|
||||
|
||||
/**
|
||||
* Create a condition to pattern-check this field against a quantified select.
|
||||
* <p>
|
||||
* For example a query like {@code field.notLike(any("a%", "b%"))} translates into
|
||||
* the SQL {@code (field not like 'a%' or field not like 'b%')}.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Field...)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Field...)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
* @see LikeEscapeStep#escape(char)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
LikeEscapeStep notLike(QuantifiedSelect<Record1<String>> query);
|
||||
|
||||
/**
|
||||
* Create a condition to case-insensitively pattern-check this field against
|
||||
* a field.
|
||||
@ -2725,174 +2797,6 @@ extends
|
||||
// Comparison predicates
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* <code>this = [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition equal(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this = [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition eq(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this != [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition notEqual(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this != [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition ne(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this < [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition lessThan(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this < [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition lt(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this <= [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition lessOrEqual(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this <= [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition le(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this > [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition greaterThan(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this > [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition gt(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this >= [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition greaterOrEqual(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* <code>this >= [quantifier] (Select<?> …)</code>.
|
||||
*
|
||||
* @see DSL#all(Field)
|
||||
* @see DSL#all(Select)
|
||||
* @see DSL#all(Object...)
|
||||
* @see DSL#any(Field)
|
||||
* @see DSL#any(Select)
|
||||
* @see DSL#any(Object...)
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, YUGABYTEDB })
|
||||
Condition ge(QuantifiedSelect<? extends Record1<T>> query);
|
||||
|
||||
/**
|
||||
* Create a condition to check this field against known string literals for
|
||||
* <code>true</code>.
|
||||
|
||||
@ -415,6 +415,11 @@ implements
|
||||
return new Eq<>(this, nullSafe(arg2, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition eq(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return new EqQuantified<>(this, arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition equal(T arg2) {
|
||||
return eq(arg2);
|
||||
@ -430,6 +435,11 @@ implements
|
||||
return eq(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition equal(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return eq(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition ge(T arg2) {
|
||||
return new Ge<>(this, Tools.field(arg2, this));
|
||||
@ -445,6 +455,11 @@ implements
|
||||
return new Ge<>(this, nullSafe(arg2, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition ge(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return new GeQuantified<>(this, arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition greaterOrEqual(T arg2) {
|
||||
return ge(arg2);
|
||||
@ -460,6 +475,11 @@ implements
|
||||
return ge(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition greaterOrEqual(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return ge(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition greaterThan(T arg2) {
|
||||
return gt(arg2);
|
||||
@ -475,6 +495,11 @@ implements
|
||||
return gt(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition greaterThan(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return gt(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition gt(T arg2) {
|
||||
return new Gt<>(this, Tools.field(arg2, this));
|
||||
@ -490,6 +515,11 @@ implements
|
||||
return new Gt<>(this, nullSafe(arg2, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition gt(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return new GtQuantified<>(this, arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition in(Select<? extends Record1<T>> arg2) {
|
||||
return new In<>(this, arg2);
|
||||
@ -550,6 +580,11 @@ implements
|
||||
return new Le<>(this, nullSafe(arg2, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition le(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return new LeQuantified<>(this, arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition lessOrEqual(T arg2) {
|
||||
return le(arg2);
|
||||
@ -565,6 +600,11 @@ implements
|
||||
return le(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition lessOrEqual(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return le(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition lessThan(T arg2) {
|
||||
return lt(arg2);
|
||||
@ -580,6 +620,11 @@ implements
|
||||
return lt(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition lessThan(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return lt(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep like(String pattern) {
|
||||
return new Like(this, Tools.field(pattern));
|
||||
@ -590,6 +635,11 @@ implements
|
||||
return new Like(this, nullSafe(pattern, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep like(org.jooq.QuantifiedSelect<? extends Record1<String>> pattern) {
|
||||
return new LikeQuantified(this, pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep likeIgnoreCase(String pattern) {
|
||||
return new LikeIgnoreCase(this, Tools.field(pattern));
|
||||
@ -615,6 +665,11 @@ implements
|
||||
return new Lt<>(this, nullSafe(arg2, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition lt(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return new LtQuantified<>(this, arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition ne(T arg2) {
|
||||
return new Ne<>(this, Tools.field(arg2, this));
|
||||
@ -630,6 +685,11 @@ implements
|
||||
return new Ne<>(this, nullSafe(arg2, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition ne(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return new NeQuantified<>(this, arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notEqual(T arg2) {
|
||||
return ne(arg2);
|
||||
@ -645,6 +705,11 @@ implements
|
||||
return ne(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notEqual(org.jooq.QuantifiedSelect<? extends Record1<T>> arg2) {
|
||||
return ne(arg2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notIn(Select<? extends Record1<T>> arg2) {
|
||||
return new NotIn<>(this, arg2);
|
||||
@ -660,6 +725,11 @@ implements
|
||||
return new NotLike(this, nullSafe(pattern, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep notLike(org.jooq.QuantifiedSelect<? extends Record1<String>> pattern) {
|
||||
return new NotLikeQuantified(this, pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep notLikeIgnoreCase(String pattern) {
|
||||
return new NotLikeIgnoreCase(this, Tools.field(pattern));
|
||||
@ -680,6 +750,11 @@ implements
|
||||
return new NotSimilarTo(this, nullSafe(pattern, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep notSimilarTo(org.jooq.QuantifiedSelect<? extends Record1<String>> pattern) {
|
||||
return new NotSimilarToQuantified(this, pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep similarTo(String pattern) {
|
||||
return new SimilarTo(this, Tools.field(pattern));
|
||||
@ -690,6 +765,11 @@ implements
|
||||
return new SimilarTo(this, nullSafe(pattern, getDataType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep similarTo(org.jooq.QuantifiedSelect<? extends Record1<String>> pattern) {
|
||||
return new SimilarToQuantified(this, pattern);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XML predicates
|
||||
// -------------------------------------------------------------------------
|
||||
@ -1170,11 +1250,6 @@ implements
|
||||
return like(field).escape(escape);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep like(QuantifiedSelect<Record1<String>> query) {
|
||||
return new QuantifiedComparisonCondition(query, this, LIKE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition likeIgnoreCase(String value, char escape) {
|
||||
return likeIgnoreCase(Tools.field(value), escape);
|
||||
@ -1205,11 +1280,6 @@ implements
|
||||
return notLike(field).escape(escape);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final LikeEscapeStep notLike(QuantifiedSelect<Record1<String>> query) {
|
||||
return new QuantifiedComparisonCondition(query, this, NOT_LIKE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notLikeIgnoreCase(String value, char escape) {
|
||||
return notLikeIgnoreCase(Tools.field(value), escape);
|
||||
@ -1398,36 +1468,6 @@ implements
|
||||
return new BetweenCondition<>(this, nullSafe(minValue, getDataType()), true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition eq(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return equal(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition ne(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return notEqual(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition lt(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return lessThan(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition le(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return lessOrEqual(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition gt(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return greaterThan(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition ge(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return greaterOrEqual(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition equalIgnoreCase(String value) {
|
||||
return equalIgnoreCase(Tools.field(value));
|
||||
@ -1438,11 +1478,6 @@ implements
|
||||
return DSL.lower(castIfNeeded(this, String.class)).equal(DSL.lower(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition equal(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return compare(EQUALS, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notEqualIgnoreCase(String value) {
|
||||
return notEqualIgnoreCase(Tools.field(value));
|
||||
@ -1453,31 +1488,6 @@ implements
|
||||
return DSL.lower(castIfNeeded(this, String.class)).notEqual(DSL.lower(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition notEqual(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return compare(NOT_EQUALS, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition lessThan(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return compare(LESS, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition lessOrEqual(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return compare(LESS_OR_EQUAL, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition greaterThan(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return compare(GREATER, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition greaterOrEqual(QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return compare(GREATER_OR_EQUAL, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Condition compare(Comparator comparator, T value) {
|
||||
return compare(comparator, Tools.field(value, this));
|
||||
@ -1541,7 +1551,30 @@ implements
|
||||
|
||||
@Override
|
||||
public final Condition compare(Comparator comparator, QuantifiedSelect<? extends Record1<T>> query) {
|
||||
return new QuantifiedComparisonCondition(query, this, comparator);
|
||||
switch (comparator) {
|
||||
case EQUALS:
|
||||
return new EqQuantified<>(this, query);
|
||||
case GREATER:
|
||||
return new GtQuantified<>(this, query);
|
||||
case GREATER_OR_EQUAL:
|
||||
return new GeQuantified<>(this, query);
|
||||
case LESS:
|
||||
return new LtQuantified<>(this, query);
|
||||
case LESS_OR_EQUAL:
|
||||
return new LeQuantified<>(this, query);
|
||||
case NOT_EQUALS:
|
||||
return new NeQuantified<>(this, query);
|
||||
case LIKE:
|
||||
return new LikeQuantified(this, (QuantifiedSelect) query);
|
||||
case NOT_LIKE:
|
||||
return new NotLikeQuantified(this, (QuantifiedSelect) query);
|
||||
case SIMILAR_TO:
|
||||
return new SimilarToQuantified(this, (QuantifiedSelect) query);
|
||||
case NOT_SIMILAR_TO:
|
||||
return new NotSimilarToQuantified(this, (QuantifiedSelect) query);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Comparator not supported: " + comparator);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@ -121,7 +121,7 @@ final class Array<T> extends AbstractField<T[]> implements QOM.Array<T> {
|
||||
|
||||
@Override
|
||||
public final UnmodifiableList<? extends Field<T>> $elements() {
|
||||
return (UnmodifiableList<? extends Field<T>>) QOM.unmodifiable(fields.fields);
|
||||
return (UnmodifiableList) QOM.unmodifiable(fields.fields);
|
||||
}
|
||||
|
||||
|
||||
|
||||
402
jOOQ/src/main/java/org/jooq/impl/EqQuantified.java
Normal file
402
jOOQ/src/main/java/org/jooq/impl/EqQuantified.java
Normal file
@ -0,0 +1,402 @@
|
||||
/*
|
||||
* 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>EQ</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class EqQuantified<T>
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.EqQuantified<T>
|
||||
{
|
||||
|
||||
final Field<T> arg1;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<T>> arg2;
|
||||
|
||||
EqQuantified(
|
||||
Field<T> arg1,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<T>> arg2
|
||||
) {
|
||||
|
||||
this.arg1 = nullSafeNotNull(arg1, (DataType) OTHER);
|
||||
this.arg2 = arg2;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
private static final Set<SQLDialect> NO_SUPPORT_QUANTIFIED_LIKE = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, SQLITE);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_QUANTIFIED_SIMILAR_TO = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB);
|
||||
private static final Set<SQLDialect> SUPPORTS_QUANTIFIED_ARRAYS = SQLDialect.supportedBy(POSTGRES);
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.EQUALS, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated - [#12425] After the QOM refactoring, this should be improved
|
||||
*/
|
||||
@Deprecated
|
||||
static final <T> void acceptCompareCondition(
|
||||
Context<?> ctx,
|
||||
AbstractCondition condition,
|
||||
Field<T> arg1,
|
||||
org.jooq.Comparator op,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<T>> arg2
|
||||
) {
|
||||
acceptCompareCondition(ctx, condition, arg1, op, arg2, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated - [#12425] After the QOM refactoring, this should be improved
|
||||
*/
|
||||
@Deprecated
|
||||
static final <T> void acceptCompareCondition(
|
||||
Context<?> ctx,
|
||||
AbstractCondition condition,
|
||||
Field<T> arg1,
|
||||
org.jooq.Comparator op,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<T>> arg2,
|
||||
Character escape
|
||||
) {
|
||||
SelectQueryImpl<?> s;
|
||||
|
||||
if (arg1.getDataType().isEmbeddable()) {
|
||||
ctx.visit(row(embeddedFields(arg1)).compare(op, arg2));
|
||||
}
|
||||
else if ((op == org.jooq.Comparator.EQUALS || op == org.jooq.Comparator.NOT_EQUALS)
|
||||
&& (arg2 instanceof QOM.QuantifiedSelect)
|
||||
&& (s = Transformations.subqueryWithLimit(((QOM.QuantifiedSelect<?>) arg2).$query())) != null
|
||||
&& Transformations.transformInConditionSubqueryWithLimitToDerivedTable(ctx.configuration())) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else {
|
||||
boolean quantifiedArrayParam = arg2 instanceof QOM.QuantifiedArray<?> a ? a.$arg2() instanceof Param : false;
|
||||
boolean quantifiedArray = arg2 instanceof QOM.QuantifiedArray<?> a ? a.$arg2() instanceof Array : false;
|
||||
boolean emulateOperator;
|
||||
|
||||
switch (op) {
|
||||
case LIKE:
|
||||
case NOT_LIKE:
|
||||
case LIKE_IGNORE_CASE:
|
||||
case NOT_LIKE_IGNORE_CASE:
|
||||
emulateOperator = escape != null || NO_SUPPORT_QUANTIFIED_LIKE.contains(ctx.dialect());
|
||||
break;
|
||||
case SIMILAR_TO:
|
||||
case NOT_SIMILAR_TO:
|
||||
emulateOperator = escape != null || NO_SUPPORT_QUANTIFIED_SIMILAR_TO.contains(ctx.dialect());
|
||||
break;
|
||||
default:
|
||||
emulateOperator = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// [#9224] Special case when a SQL dialect actually supports quantified
|
||||
// arrays, such as x = any(?::int[]) in PostgreSQL
|
||||
if (quantifiedArrayParam && SUPPORTS_QUANTIFIED_ARRAYS.contains(ctx.dialect()) && !emulateOperator) {
|
||||
accept1(ctx, arg1, op, arg2);
|
||||
}
|
||||
else if (quantifiedArrayParam || quantifiedArray) {
|
||||
QOM.QuantifiedArray<?> a = (org.jooq.impl.QOM.QuantifiedArray<?>) arg2;
|
||||
ctx.visit(DSL.condition(
|
||||
a.$quantifier() == Quantifier.ALL ? org.jooq.Operator.AND : org.jooq.Operator.OR,
|
||||
a.$array() instanceof Array
|
||||
? map(((Array) a.$array()).$elements(), v -> comparisonCondition(arg1, op, (Field<String>) v, escape))
|
||||
: map(((Param<? extends Object[]>) a.$array()).getValue(), v -> v instanceof Field ? comparisonCondition(arg1, op, (Field<String>) v, escape) : comparisonCondition(arg1, op, v, escape))
|
||||
));
|
||||
}
|
||||
else if (emulateOperator) {
|
||||
Field<String> pattern = DSL.field(name("pattern"), VARCHAR);
|
||||
Condition c;
|
||||
Field<Boolean> lhs;
|
||||
|
||||
switch (op) {
|
||||
case NOT_LIKE:
|
||||
case NOT_SIMILAR_TO:
|
||||
case NOT_LIKE_IGNORE_CASE:
|
||||
c = comparisonCondition(arg1, inverse(op), pattern, escape);
|
||||
lhs = inline(false);
|
||||
break;
|
||||
case LIKE:
|
||||
case SIMILAR_TO:
|
||||
case LIKE_IGNORE_CASE:
|
||||
c = comparisonCondition(arg1, op, pattern, escape);
|
||||
lhs = inline(true);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
Table<?> t;
|
||||
Quantifier q;
|
||||
|
||||
if (arg2 instanceof QuantifiedArray<?> a) {
|
||||
t = new ArrayTable(a.$array()).asTable("t", "pattern");
|
||||
q = a.$quantifier();
|
||||
}
|
||||
else {
|
||||
QOM.QuantifiedSelect<?> qs = (QOM.QuantifiedSelect<?>) arg2;
|
||||
t = new AliasedSelect<>(qs.$query(), true, true, false, name("pattern")).as("t");
|
||||
q = qs.$quantifier();
|
||||
}
|
||||
|
||||
ctx.visit(lhs.eq(quantify(q, select(c).from(t))));
|
||||
}
|
||||
else
|
||||
accept1(ctx, arg1, op, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
private static final void accept1(
|
||||
Context<?> ctx,
|
||||
Field<?> arg1,
|
||||
org.jooq.Comparator op,
|
||||
org.jooq.QuantifiedSelect<?> arg2
|
||||
) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
ctx.visit(arg1)
|
||||
.sql(' ')
|
||||
.visit(op.toKeyword())
|
||||
.sql(' ')
|
||||
.visit(arg2);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static final org.jooq.Comparator inverse(org.jooq.Comparator operator) {
|
||||
switch (operator) {
|
||||
case IN: return org.jooq.Comparator.NOT_IN;
|
||||
case NOT_IN: return org.jooq.Comparator.IN;
|
||||
case EQUALS: return org.jooq.Comparator.NOT_EQUALS;
|
||||
case NOT_EQUALS: return org.jooq.Comparator.EQUALS;
|
||||
case LESS: return org.jooq.Comparator.GREATER_OR_EQUAL;
|
||||
case LESS_OR_EQUAL: return org.jooq.Comparator.GREATER;
|
||||
case GREATER: return org.jooq.Comparator.LESS_OR_EQUAL;
|
||||
case GREATER_OR_EQUAL: return org.jooq.Comparator.LESS;
|
||||
case IS_DISTINCT_FROM: return org.jooq.Comparator.IS_NOT_DISTINCT_FROM;
|
||||
case IS_NOT_DISTINCT_FROM: return org.jooq.Comparator.IS_DISTINCT_FROM;
|
||||
case LIKE: return org.jooq.Comparator.NOT_LIKE;
|
||||
case NOT_LIKE: return org.jooq.Comparator.LIKE;
|
||||
case SIMILAR_TO: return org.jooq.Comparator.NOT_SIMILAR_TO;
|
||||
case NOT_SIMILAR_TO: return org.jooq.Comparator.SIMILAR_TO;
|
||||
case LIKE_IGNORE_CASE: return org.jooq.Comparator.NOT_LIKE_IGNORE_CASE;
|
||||
case NOT_LIKE_IGNORE_CASE: return org.jooq.Comparator.LIKE_IGNORE_CASE;
|
||||
default: throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
private static final Condition comparisonCondition(
|
||||
Field<?> arg1,
|
||||
org.jooq.Comparator op,
|
||||
Field<String> arg2,
|
||||
Character escape
|
||||
) {
|
||||
switch (op) {
|
||||
case LIKE:
|
||||
return escape != null ? arg1.like(arg2, escape) : arg1.like(arg2);
|
||||
|
||||
case NOT_LIKE:
|
||||
return escape != null ? arg1.notLike(arg2, escape) : arg1.notLike(arg2);
|
||||
|
||||
case SIMILAR_TO:
|
||||
return escape != null ? arg1.similarTo(arg2, escape) : arg1.similarTo(arg2);
|
||||
|
||||
case NOT_SIMILAR_TO:
|
||||
return escape != null ? arg1.notSimilarTo(arg2, escape) : arg1.notSimilarTo(arg2);
|
||||
|
||||
case LIKE_IGNORE_CASE:
|
||||
return escape != null ? arg1.likeIgnoreCase(arg2, escape) : arg1.likeIgnoreCase(arg2);
|
||||
|
||||
case NOT_LIKE_IGNORE_CASE:
|
||||
return escape != null ? arg1.notLikeIgnoreCase(arg2, escape) : arg1.notLikeIgnoreCase(arg2);
|
||||
|
||||
default:
|
||||
return ((Field) arg1).compare(op, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private static final Condition comparisonCondition(
|
||||
Field<?> arg1,
|
||||
org.jooq.Comparator op,
|
||||
Object arg2,
|
||||
Character escape
|
||||
) {
|
||||
switch (op) {
|
||||
case LIKE:
|
||||
return escape != null ? arg1.like(Convert.convert(arg2, String.class), escape) : arg1.like(Convert.convert(arg2, String.class));
|
||||
|
||||
case NOT_LIKE:
|
||||
return escape != null ? arg1.notLike(Convert.convert(arg2, String.class), escape) : arg1.notLike(Convert.convert(arg2, String.class));
|
||||
|
||||
case SIMILAR_TO:
|
||||
return escape != null ? arg1.similarTo(Convert.convert(arg2, String.class), escape) : arg1.similarTo(Convert.convert(arg2, String.class));
|
||||
|
||||
case NOT_SIMILAR_TO:
|
||||
return escape != null ? arg1.notSimilarTo(Convert.convert(arg2, String.class), escape) : arg1.notSimilarTo(Convert.convert(arg2, String.class));
|
||||
|
||||
case LIKE_IGNORE_CASE:
|
||||
return escape != null ? arg1.likeIgnoreCase(Convert.convert(arg2, String.class), escape) : arg1.likeIgnoreCase(Convert.convert(arg2, String.class));
|
||||
|
||||
case NOT_LIKE_IGNORE_CASE:
|
||||
return escape != null ? arg1.notLikeIgnoreCase(Convert.convert(arg2, String.class), escape) : arg1.notLikeIgnoreCase(Convert.convert(arg2, String.class));
|
||||
|
||||
default:
|
||||
return ((Field) arg1).compare(op, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<T> $arg1() {
|
||||
return arg1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<T>> $arg2() {
|
||||
return arg2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.EqQuantified<T> $arg1(Field<T> newValue) {
|
||||
return $constructor().apply(newValue, $arg2());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.EqQuantified<T> $arg2(org.jooq.QuantifiedSelect<? extends Record1<T>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function2<? super Field<T>, ? super org.jooq.QuantifiedSelect<? extends Record1<T>>, ? extends QOM.EqQuantified<T>> $constructor() {
|
||||
return (a1, a2) -> new EqQuantified<>(a1, a2);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.EqQuantified<?> o) {
|
||||
return
|
||||
StringUtils.equals($arg1(), o.$arg1()) &&
|
||||
StringUtils.equals($arg2(), o.$arg2())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
160
jOOQ/src/main/java/org/jooq/impl/GeQuantified.java
Normal file
160
jOOQ/src/main/java/org/jooq/impl/GeQuantified.java
Normal 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>GE</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class GeQuantified<T>
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.GeQuantified<T>
|
||||
{
|
||||
|
||||
final Field<T> arg1;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<T>> arg2;
|
||||
|
||||
GeQuantified(
|
||||
Field<T> arg1,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<T>> arg2
|
||||
) {
|
||||
|
||||
this.arg1 = nullSafeNotNull(arg1, (DataType) OTHER);
|
||||
this.arg2 = arg2;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.GREATER_OR_EQUAL, arg2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<T> $arg1() {
|
||||
return arg1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<T>> $arg2() {
|
||||
return arg2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.GeQuantified<T> $arg1(Field<T> newValue) {
|
||||
return $constructor().apply(newValue, $arg2());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.GeQuantified<T> $arg2(org.jooq.QuantifiedSelect<? extends Record1<T>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function2<? super Field<T>, ? super org.jooq.QuantifiedSelect<? extends Record1<T>>, ? extends QOM.GeQuantified<T>> $constructor() {
|
||||
return (a1, a2) -> new GeQuantified<>(a1, a2);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.GeQuantified<?> o) {
|
||||
return
|
||||
StringUtils.equals($arg1(), o.$arg1()) &&
|
||||
StringUtils.equals($arg2(), o.$arg2())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
160
jOOQ/src/main/java/org/jooq/impl/GtQuantified.java
Normal file
160
jOOQ/src/main/java/org/jooq/impl/GtQuantified.java
Normal 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>GT</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class GtQuantified<T>
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.GtQuantified<T>
|
||||
{
|
||||
|
||||
final Field<T> arg1;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<T>> arg2;
|
||||
|
||||
GtQuantified(
|
||||
Field<T> arg1,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<T>> arg2
|
||||
) {
|
||||
|
||||
this.arg1 = nullSafeNotNull(arg1, (DataType) OTHER);
|
||||
this.arg2 = arg2;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.GREATER, arg2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<T> $arg1() {
|
||||
return arg1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<T>> $arg2() {
|
||||
return arg2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.GtQuantified<T> $arg1(Field<T> newValue) {
|
||||
return $constructor().apply(newValue, $arg2());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.GtQuantified<T> $arg2(org.jooq.QuantifiedSelect<? extends Record1<T>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function2<? super Field<T>, ? super org.jooq.QuantifiedSelect<? extends Record1<T>>, ? extends QOM.GtQuantified<T>> $constructor() {
|
||||
return (a1, a2) -> new GtQuantified<>(a1, a2);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.GtQuantified<?> o) {
|
||||
return
|
||||
StringUtils.equals($arg1(), o.$arg1()) &&
|
||||
StringUtils.equals($arg2(), o.$arg2())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
160
jOOQ/src/main/java/org/jooq/impl/LeQuantified.java
Normal file
160
jOOQ/src/main/java/org/jooq/impl/LeQuantified.java
Normal 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>LE</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class LeQuantified<T>
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.LeQuantified<T>
|
||||
{
|
||||
|
||||
final Field<T> arg1;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<T>> arg2;
|
||||
|
||||
LeQuantified(
|
||||
Field<T> arg1,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<T>> arg2
|
||||
) {
|
||||
|
||||
this.arg1 = nullSafeNotNull(arg1, (DataType) OTHER);
|
||||
this.arg2 = arg2;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.LESS_OR_EQUAL, arg2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<T> $arg1() {
|
||||
return arg1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<T>> $arg2() {
|
||||
return arg2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.LeQuantified<T> $arg1(Field<T> newValue) {
|
||||
return $constructor().apply(newValue, $arg2());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.LeQuantified<T> $arg2(org.jooq.QuantifiedSelect<? extends Record1<T>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function2<? super Field<T>, ? super org.jooq.QuantifiedSelect<? extends Record1<T>>, ? extends QOM.LeQuantified<T>> $constructor() {
|
||||
return (a1, a2) -> new LeQuantified<>(a1, a2);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.LeQuantified<?> o) {
|
||||
return
|
||||
StringUtils.equals($arg1(), o.$arg1()) &&
|
||||
StringUtils.equals($arg2(), o.$arg2())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
197
jOOQ/src/main/java/org/jooq/impl/LikeQuantified.java
Normal file
197
jOOQ/src/main/java/org/jooq/impl/LikeQuantified.java
Normal file
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* 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.EqQuantified;
|
||||
import org.jooq.impl.QOM.*;
|
||||
import org.jooq.tools.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>LIKE</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "hiding", "rawtypes", "unused" })
|
||||
final class LikeQuantified
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.LikeQuantified,
|
||||
LikeEscapeStep
|
||||
{
|
||||
|
||||
final Field<?> value;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<String>> pattern;
|
||||
Character escape;
|
||||
|
||||
LikeQuantified(
|
||||
Field<?> value,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<String>> pattern
|
||||
) {
|
||||
this(
|
||||
value,
|
||||
pattern,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
LikeQuantified(
|
||||
Field<?> value,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<String>> pattern,
|
||||
Character escape
|
||||
) {
|
||||
|
||||
this.value = nullSafeNotNull(value, OTHER);
|
||||
this.pattern = pattern;
|
||||
this.escape = escape;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: DSL API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final LikeQuantified escape(char escape) {
|
||||
this.escape = escape;
|
||||
return this;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, (Field<String>) value, org.jooq.Comparator.LIKE, pattern, escape);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<?> $arg1() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<String>> $arg2() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Character $arg3() {
|
||||
return escape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.LikeQuantified $arg1(Field<?> newValue) {
|
||||
return $constructor().apply(newValue, $arg2(), $arg3());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.LikeQuantified $arg2(org.jooq.QuantifiedSelect<? extends Record1<String>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue, $arg3());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.LikeQuantified $arg3(Character newValue) {
|
||||
return $constructor().apply($arg1(), $arg2(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function3<? super Field<?>, ? super org.jooq.QuantifiedSelect<? extends Record1<String>>, ? super Character, ? extends QOM.LikeQuantified> $constructor() {
|
||||
return (a1, a2, a3) -> new LikeQuantified(a1, a2, a3);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.LikeQuantified o) {
|
||||
return
|
||||
StringUtils.equals($value(), o.$value()) &&
|
||||
StringUtils.equals($pattern(), o.$pattern()) &&
|
||||
StringUtils.equals($escape(), o.$escape())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
160
jOOQ/src/main/java/org/jooq/impl/LtQuantified.java
Normal file
160
jOOQ/src/main/java/org/jooq/impl/LtQuantified.java
Normal 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>LT</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class LtQuantified<T>
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.LtQuantified<T>
|
||||
{
|
||||
|
||||
final Field<T> arg1;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<T>> arg2;
|
||||
|
||||
LtQuantified(
|
||||
Field<T> arg1,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<T>> arg2
|
||||
) {
|
||||
|
||||
this.arg1 = nullSafeNotNull(arg1, (DataType) OTHER);
|
||||
this.arg2 = arg2;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.LESS, arg2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<T> $arg1() {
|
||||
return arg1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<T>> $arg2() {
|
||||
return arg2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.LtQuantified<T> $arg1(Field<T> newValue) {
|
||||
return $constructor().apply(newValue, $arg2());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.LtQuantified<T> $arg2(org.jooq.QuantifiedSelect<? extends Record1<T>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function2<? super Field<T>, ? super org.jooq.QuantifiedSelect<? extends Record1<T>>, ? extends QOM.LtQuantified<T>> $constructor() {
|
||||
return (a1, a2) -> new LtQuantified<>(a1, a2);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.LtQuantified<?> o) {
|
||||
return
|
||||
StringUtils.equals($arg1(), o.$arg1()) &&
|
||||
StringUtils.equals($arg2(), o.$arg2())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
160
jOOQ/src/main/java/org/jooq/impl/NeQuantified.java
Normal file
160
jOOQ/src/main/java/org/jooq/impl/NeQuantified.java
Normal 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>NE</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
final class NeQuantified<T>
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.NeQuantified<T>
|
||||
{
|
||||
|
||||
final Field<T> arg1;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<T>> arg2;
|
||||
|
||||
NeQuantified(
|
||||
Field<T> arg1,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<T>> arg2
|
||||
) {
|
||||
|
||||
this.arg1 = nullSafeNotNull(arg1, (DataType) OTHER);
|
||||
this.arg2 = arg2;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, arg1, org.jooq.Comparator.NOT_EQUALS, arg2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<T> $arg1() {
|
||||
return arg1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<T>> $arg2() {
|
||||
return arg2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.NeQuantified<T> $arg1(Field<T> newValue) {
|
||||
return $constructor().apply(newValue, $arg2());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.NeQuantified<T> $arg2(org.jooq.QuantifiedSelect<? extends Record1<T>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function2<? super Field<T>, ? super org.jooq.QuantifiedSelect<? extends Record1<T>>, ? extends QOM.NeQuantified<T>> $constructor() {
|
||||
return (a1, a2) -> new NeQuantified<>(a1, a2);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.NeQuantified<?> o) {
|
||||
return
|
||||
StringUtils.equals($arg1(), o.$arg1()) &&
|
||||
StringUtils.equals($arg2(), o.$arg2())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
197
jOOQ/src/main/java/org/jooq/impl/NotLikeQuantified.java
Normal file
197
jOOQ/src/main/java/org/jooq/impl/NotLikeQuantified.java
Normal file
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* 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.EqQuantified;
|
||||
import org.jooq.impl.QOM.*;
|
||||
import org.jooq.tools.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>NOT LIKE</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "hiding", "rawtypes", "unused" })
|
||||
final class NotLikeQuantified
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.NotLikeQuantified,
|
||||
LikeEscapeStep
|
||||
{
|
||||
|
||||
final Field<?> value;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<String>> pattern;
|
||||
Character escape;
|
||||
|
||||
NotLikeQuantified(
|
||||
Field<?> value,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<String>> pattern
|
||||
) {
|
||||
this(
|
||||
value,
|
||||
pattern,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
NotLikeQuantified(
|
||||
Field<?> value,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<String>> pattern,
|
||||
Character escape
|
||||
) {
|
||||
|
||||
this.value = nullSafeNotNull(value, OTHER);
|
||||
this.pattern = pattern;
|
||||
this.escape = escape;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: DSL API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final NotLikeQuantified escape(char escape) {
|
||||
this.escape = escape;
|
||||
return this;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, (Field<String>) value, org.jooq.Comparator.NOT_LIKE, pattern, escape);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<?> $arg1() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<String>> $arg2() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Character $arg3() {
|
||||
return escape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.NotLikeQuantified $arg1(Field<?> newValue) {
|
||||
return $constructor().apply(newValue, $arg2(), $arg3());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.NotLikeQuantified $arg2(org.jooq.QuantifiedSelect<? extends Record1<String>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue, $arg3());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.NotLikeQuantified $arg3(Character newValue) {
|
||||
return $constructor().apply($arg1(), $arg2(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function3<? super Field<?>, ? super org.jooq.QuantifiedSelect<? extends Record1<String>>, ? super Character, ? extends QOM.NotLikeQuantified> $constructor() {
|
||||
return (a1, a2, a3) -> new NotLikeQuantified(a1, a2, a3);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.NotLikeQuantified o) {
|
||||
return
|
||||
StringUtils.equals($value(), o.$value()) &&
|
||||
StringUtils.equals($pattern(), o.$pattern()) &&
|
||||
StringUtils.equals($escape(), o.$escape())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
197
jOOQ/src/main/java/org/jooq/impl/NotSimilarToQuantified.java
Normal file
197
jOOQ/src/main/java/org/jooq/impl/NotSimilarToQuantified.java
Normal file
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* 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.EqQuantified;
|
||||
import org.jooq.impl.QOM.*;
|
||||
import org.jooq.tools.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>NOT SIMILAR TO</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "hiding", "rawtypes", "unused" })
|
||||
final class NotSimilarToQuantified
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.NotSimilarToQuantified,
|
||||
LikeEscapeStep
|
||||
{
|
||||
|
||||
final Field<?> value;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<String>> pattern;
|
||||
Character escape;
|
||||
|
||||
NotSimilarToQuantified(
|
||||
Field<?> value,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<String>> pattern
|
||||
) {
|
||||
this(
|
||||
value,
|
||||
pattern,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
NotSimilarToQuantified(
|
||||
Field<?> value,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<String>> pattern,
|
||||
Character escape
|
||||
) {
|
||||
|
||||
this.value = nullSafeNotNull(value, OTHER);
|
||||
this.pattern = pattern;
|
||||
this.escape = escape;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: DSL API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final NotSimilarToQuantified escape(char escape) {
|
||||
this.escape = escape;
|
||||
return this;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, (Field<String>) value, org.jooq.Comparator.NOT_SIMILAR_TO, pattern, escape);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<?> $arg1() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<String>> $arg2() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Character $arg3() {
|
||||
return escape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.NotSimilarToQuantified $arg1(Field<?> newValue) {
|
||||
return $constructor().apply(newValue, $arg2(), $arg3());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.NotSimilarToQuantified $arg2(org.jooq.QuantifiedSelect<? extends Record1<String>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue, $arg3());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.NotSimilarToQuantified $arg3(Character newValue) {
|
||||
return $constructor().apply($arg1(), $arg2(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function3<? super Field<?>, ? super org.jooq.QuantifiedSelect<? extends Record1<String>>, ? super Character, ? extends QOM.NotSimilarToQuantified> $constructor() {
|
||||
return (a1, a2, a3) -> new NotSimilarToQuantified(a1, a2, a3);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.NotSimilarToQuantified o) {
|
||||
return
|
||||
StringUtils.equals($value(), o.$value()) &&
|
||||
StringUtils.equals($pattern(), o.$pattern()) &&
|
||||
StringUtils.equals($escape(), o.$escape())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
@ -113,6 +113,7 @@ import org.jooq.Param;
|
||||
import org.jooq.Parameter;
|
||||
import org.jooq.Privilege;
|
||||
// ...
|
||||
import org.jooq.QuantifiedSelect;
|
||||
import org.jooq.Query;
|
||||
import org.jooq.QueryPart;
|
||||
import org.jooq.Record;
|
||||
@ -1050,7 +1051,6 @@ public final class QOM {
|
||||
@NotNull default QuantifiedArray<T> $array(Field<T[]> newArray) { return $arg2(newArray); }
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Rows
|
||||
// -------------------------------------------------------------------------
|
||||
@ -1569,6 +1569,12 @@ public final class QOM {
|
||||
ScalarSubquery*/
|
||||
{}
|
||||
|
||||
public /*sealed*/ interface RowSubquery
|
||||
extends
|
||||
Row,
|
||||
UOperator1<Select<?>, RowSubquery>
|
||||
{}
|
||||
|
||||
public /*sealed*/ interface Neg<T>
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
@ -2798,6 +2804,18 @@ public final class QOM {
|
||||
// Eq
|
||||
{}
|
||||
|
||||
/**
|
||||
* The <code>EQ</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface EqQuantified<T>
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator2<Field<T>, org.jooq.QuantifiedSelect<? extends Record1<T>>, EqQuantified<T>>,
|
||||
org.jooq.Condition
|
||||
//permits
|
||||
// EqQuantified
|
||||
{}
|
||||
|
||||
/**
|
||||
* The <code>EXISTS</code> function.
|
||||
*/
|
||||
@ -2830,6 +2848,18 @@ public final class QOM {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>GE</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface GeQuantified<T>
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator2<Field<T>, org.jooq.QuantifiedSelect<? extends Record1<T>>, GeQuantified<T>>,
|
||||
org.jooq.Condition
|
||||
//permits
|
||||
// GeQuantified
|
||||
{}
|
||||
|
||||
/**
|
||||
* The <code>GT</code> operator.
|
||||
*/
|
||||
@ -2847,6 +2877,18 @@ public final class QOM {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>GT</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface GtQuantified<T>
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator2<Field<T>, org.jooq.QuantifiedSelect<? extends Record1<T>>, GtQuantified<T>>,
|
||||
org.jooq.Condition
|
||||
//permits
|
||||
// GtQuantified
|
||||
{}
|
||||
|
||||
/**
|
||||
* The <code>IN</code> operator.
|
||||
* <p>
|
||||
@ -2937,6 +2979,18 @@ public final class QOM {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LE</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface LeQuantified<T>
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator2<Field<T>, org.jooq.QuantifiedSelect<? extends Record1<T>>, LeQuantified<T>>,
|
||||
org.jooq.Condition
|
||||
//permits
|
||||
// LeQuantified
|
||||
{}
|
||||
|
||||
/**
|
||||
* The <code>LIKE</code> operator.
|
||||
*/
|
||||
@ -2959,6 +3013,28 @@ public final class QOM {
|
||||
@NotNull default Like $escape(Character newEscape) { return $arg3(newEscape); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LIKE</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface LikeQuantified
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator3<Field<?>, org.jooq.QuantifiedSelect<? extends Record1<String>>, Character, LikeQuantified>,
|
||||
Condition
|
||||
//permits
|
||||
// LikeQuantified
|
||||
{
|
||||
@NotNull default Field<?> $value() { return $arg1(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default LikeQuantified $value(Field<?> newValue) { return $arg1(newValue); }
|
||||
@NotNull default org.jooq.QuantifiedSelect<? extends Record1<String>> $pattern() { return $arg2(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default LikeQuantified $pattern(org.jooq.QuantifiedSelect<? extends Record1<String>> newPattern) { return $arg2(newPattern); }
|
||||
@Nullable default Character $escape() { return $arg3(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default LikeQuantified $escape(Character newEscape) { return $arg3(newEscape); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LIKE IGNORE CASE</code> operator.
|
||||
* <p>
|
||||
@ -3005,6 +3081,18 @@ public final class QOM {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>LT</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface LtQuantified<T>
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator2<Field<T>, org.jooq.QuantifiedSelect<? extends Record1<T>>, LtQuantified<T>>,
|
||||
org.jooq.Condition
|
||||
//permits
|
||||
// LtQuantified
|
||||
{}
|
||||
|
||||
/**
|
||||
* The <code>NE</code> operator.
|
||||
*/
|
||||
@ -3029,6 +3117,18 @@ public final class QOM {
|
||||
// Ne
|
||||
{}
|
||||
|
||||
/**
|
||||
* The <code>NE</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface NeQuantified<T>
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator2<Field<T>, org.jooq.QuantifiedSelect<? extends Record1<T>>, NeQuantified<T>>,
|
||||
org.jooq.Condition
|
||||
//permits
|
||||
// NeQuantified
|
||||
{}
|
||||
|
||||
/**
|
||||
* The <code>NOT</code> operator.
|
||||
*/
|
||||
@ -3102,6 +3202,28 @@ public final class QOM {
|
||||
@NotNull default NotLike $escape(Character newEscape) { return $arg3(newEscape); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>NOT LIKE</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface NotLikeQuantified
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator3<Field<?>, org.jooq.QuantifiedSelect<? extends Record1<String>>, Character, NotLikeQuantified>,
|
||||
Condition
|
||||
//permits
|
||||
// NotLikeQuantified
|
||||
{
|
||||
@NotNull default Field<?> $value() { return $arg1(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default NotLikeQuantified $value(Field<?> newValue) { return $arg1(newValue); }
|
||||
@NotNull default org.jooq.QuantifiedSelect<? extends Record1<String>> $pattern() { return $arg2(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default NotLikeQuantified $pattern(org.jooq.QuantifiedSelect<? extends Record1<String>> newPattern) { return $arg2(newPattern); }
|
||||
@Nullable default Character $escape() { return $arg3(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default NotLikeQuantified $escape(Character newEscape) { return $arg3(newEscape); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>NOT LIKE IGNORE CASE</code> operator.
|
||||
* <p>
|
||||
@ -3153,6 +3275,28 @@ public final class QOM {
|
||||
@NotNull default NotSimilarTo $escape(Character newEscape) { return $arg3(newEscape); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>NOT SIMILAR TO</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface NotSimilarToQuantified
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator3<Field<?>, org.jooq.QuantifiedSelect<? extends Record1<String>>, Character, NotSimilarToQuantified>,
|
||||
Condition
|
||||
//permits
|
||||
// NotSimilarToQuantified
|
||||
{
|
||||
@NotNull default Field<?> $value() { return $arg1(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default NotSimilarToQuantified $value(Field<?> newValue) { return $arg1(newValue); }
|
||||
@NotNull default org.jooq.QuantifiedSelect<? extends Record1<String>> $pattern() { return $arg2(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default NotSimilarToQuantified $pattern(org.jooq.QuantifiedSelect<? extends Record1<String>> newPattern) { return $arg2(newPattern); }
|
||||
@Nullable default Character $escape() { return $arg3(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default NotSimilarToQuantified $escape(Character newEscape) { return $arg3(newEscape); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>OR</code> operator.
|
||||
*/
|
||||
@ -3186,6 +3330,28 @@ public final class QOM {
|
||||
@NotNull default SimilarTo $escape(Character newEscape) { return $arg3(newEscape); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>SIMILAR TO</code> operator.
|
||||
*/
|
||||
public /*sealed*/ interface SimilarToQuantified
|
||||
extends
|
||||
UReturnsNullOnNullInput,
|
||||
UOperator3<Field<?>, org.jooq.QuantifiedSelect<? extends Record1<String>>, Character, SimilarToQuantified>,
|
||||
Condition
|
||||
//permits
|
||||
// SimilarToQuantified
|
||||
{
|
||||
@NotNull default Field<?> $value() { return $arg1(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default SimilarToQuantified $value(Field<?> newValue) { return $arg1(newValue); }
|
||||
@NotNull default org.jooq.QuantifiedSelect<? extends Record1<String>> $pattern() { return $arg2(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default SimilarToQuantified $pattern(org.jooq.QuantifiedSelect<? extends Record1<String>> newPattern) { return $arg2(newPattern); }
|
||||
@Nullable default Character $escape() { return $arg3(); }
|
||||
@CheckReturnValue
|
||||
@NotNull default SimilarToQuantified $escape(Character newEscape) { return $arg3(newEscape); }
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>UNIQUE</code> function.
|
||||
*/
|
||||
|
||||
@ -1,343 +0,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
|
||||
*
|
||||
* 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.Clause.CONDITION;
|
||||
import static org.jooq.Clause.CONDITION_BETWEEN;
|
||||
import static org.jooq.Comparator.EQUALS;
|
||||
import static org.jooq.Comparator.NOT_EQUALS;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
import static org.jooq.SQLDialect.FIREBIRD;
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.HSQLDB;
|
||||
import static org.jooq.SQLDialect.IGNITE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.YUGABYTEDB;
|
||||
import static org.jooq.impl.DSL.asterisk;
|
||||
import static org.jooq.impl.DSL.inline;
|
||||
import static org.jooq.impl.DSL.name;
|
||||
import static org.jooq.impl.DSL.row;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.impl.Tools.characterLiteral;
|
||||
import static org.jooq.impl.Tools.embeddedFields;
|
||||
import static org.jooq.impl.Tools.map;
|
||||
import static org.jooq.impl.Tools.quantify;
|
||||
import static org.jooq.impl.Transformations.transformInConditionSubqueryWithLimitToDerivedTable;
|
||||
import static org.jooq.impl.Transformations.subqueryWithLimit;
|
||||
import static org.jooq.tools.Convert.convert;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Comparator;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.LikeEscapeStep;
|
||||
import org.jooq.Operator;
|
||||
import org.jooq.Param;
|
||||
import org.jooq.QuantifiedSelect;
|
||||
import org.jooq.Record1;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.Select;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.impl.QOM.Array;
|
||||
import org.jooq.impl.QOM.Quantifier;
|
||||
import org.jooq.impl.QOM.UNotYetImplemented;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
final class QuantifiedComparisonCondition extends AbstractCondition implements LikeEscapeStep, UNotYetImplemented {
|
||||
|
||||
private static final Clause[] CLAUSES = { CONDITION, CONDITION_BETWEEN };
|
||||
private static final Set<SQLDialect> NO_SUPPORT_QUANTIFIED_LIKE = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, SQLITE);
|
||||
private static final Set<SQLDialect> NO_SUPPORT_QUANTIFIED_SIMILAR_TO = SQLDialect.supportedBy(CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB);
|
||||
private static final Set<SQLDialect> SUPPORTS_QUANTIFIED_ARRAYS = SQLDialect.supportedBy(POSTGRES);
|
||||
|
||||
private final QuantifiedSelect<?> query;
|
||||
private final Field<?> field;
|
||||
private final Comparator comparator;
|
||||
private Character escape;
|
||||
|
||||
QuantifiedComparisonCondition(QuantifiedSelect<?> query, Field<?> field, Comparator comparator) {
|
||||
this.query = query;
|
||||
this.field = field;
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Condition escape(char c) {
|
||||
this.escape = c;
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
SelectQueryImpl<?> s;
|
||||
|
||||
if (field.getDataType().isEmbeddable()) {
|
||||
ctx.visit(row(embeddedFields(field)).compare(comparator, query));
|
||||
}
|
||||
else if ((comparator == EQUALS || comparator == NOT_EQUALS)
|
||||
&& (query instanceof QOM.QuantifiedSelect)
|
||||
&& (s = subqueryWithLimit(((QOM.QuantifiedSelect<?>) query).$query())) != null
|
||||
&& transformInConditionSubqueryWithLimitToDerivedTable(ctx.configuration())) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
accept0(ctx);
|
||||
}
|
||||
|
||||
private final void accept0(Context<?> ctx) {
|
||||
boolean quantifiedArrayParam = query instanceof QOM.QuantifiedArray<?> a ? a.$arg2() instanceof Param : false;
|
||||
boolean quantifiedArray = query instanceof QOM.QuantifiedArray<?> a ? a.$arg2() instanceof Array : false;
|
||||
boolean emulateOperator;
|
||||
|
||||
switch (comparator) {
|
||||
case LIKE:
|
||||
case NOT_LIKE:
|
||||
case LIKE_IGNORE_CASE:
|
||||
case NOT_LIKE_IGNORE_CASE:
|
||||
emulateOperator = escape != null || NO_SUPPORT_QUANTIFIED_LIKE.contains(ctx.dialect());
|
||||
break;
|
||||
case SIMILAR_TO:
|
||||
case NOT_SIMILAR_TO:
|
||||
emulateOperator = escape != null || NO_SUPPORT_QUANTIFIED_SIMILAR_TO.contains(ctx.dialect());
|
||||
break;
|
||||
default:
|
||||
emulateOperator = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// [#9224] Special case when a SQL dialect actually supports quantified
|
||||
// arrays, such as x = any(?::int[]) in PostgreSQL
|
||||
if (quantifiedArrayParam && SUPPORTS_QUANTIFIED_ARRAYS.contains(ctx.dialect()) && !emulateOperator) {
|
||||
accept1(ctx);
|
||||
}
|
||||
else if (quantifiedArrayParam || quantifiedArray) {
|
||||
QOM.QuantifiedArray<?> a = (org.jooq.impl.QOM.QuantifiedArray<?>) query;
|
||||
ctx.visit(DSL.condition(
|
||||
a.$quantifier() == Quantifier.ALL ? Operator.AND : Operator.OR,
|
||||
a.$array() instanceof Array
|
||||
? map(((Array) a.$array()).$elements(), v -> comparisonCondition(comparator, (Field<String>) v))
|
||||
: map(((Param<? extends Object[]>) a.$array()).getValue(), v -> v instanceof Field ? comparisonCondition(comparator, (Field<String>) v) : comparisonCondition(comparator, v))
|
||||
));
|
||||
}
|
||||
else if (emulateOperator) {
|
||||
Field<String> pattern = DSL.field(name("pattern"), VARCHAR);
|
||||
Condition condition;
|
||||
Field<Boolean> lhs;
|
||||
|
||||
switch (comparator) {
|
||||
case NOT_LIKE:
|
||||
case NOT_SIMILAR_TO:
|
||||
case NOT_LIKE_IGNORE_CASE:
|
||||
condition = comparisonCondition(inverse(comparator), pattern);
|
||||
lhs = inline(false);
|
||||
break;
|
||||
case LIKE:
|
||||
case SIMILAR_TO:
|
||||
case LIKE_IGNORE_CASE:
|
||||
condition = comparisonCondition(comparator, pattern);
|
||||
lhs = inline(true);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
Table<?> t;
|
||||
Quantifier q;
|
||||
|
||||
if (query instanceof QuantifiedArray<?> a) {
|
||||
t = new ArrayTable(a.$array()).asTable("t", "pattern");
|
||||
q = a.$quantifier();
|
||||
}
|
||||
else {
|
||||
QOM.QuantifiedSelect<?> s = (QOM.QuantifiedSelect<?>) query;
|
||||
t = new AliasedSelect<>(s.$query(), true, true, false, name("pattern")).as("t");
|
||||
q = s.$quantifier();
|
||||
}
|
||||
|
||||
ctx.visit(lhs.eq(quantify(q, select(condition).from(t))));
|
||||
}
|
||||
else {
|
||||
accept1(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
private final void accept1(Context<?> ctx) {
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
ctx.visit(field)
|
||||
.sql(' ')
|
||||
.visit(comparator.toKeyword())
|
||||
.sql(' ')
|
||||
.visit(query);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private Comparator inverse(Comparator operator) {
|
||||
switch (operator) {
|
||||
case IN: return Comparator.NOT_IN;
|
||||
case NOT_IN: return Comparator.IN;
|
||||
case EQUALS: return Comparator.NOT_EQUALS;
|
||||
case NOT_EQUALS: return Comparator.EQUALS;
|
||||
case LESS: return Comparator.GREATER_OR_EQUAL;
|
||||
case LESS_OR_EQUAL: return Comparator.GREATER;
|
||||
case GREATER: return Comparator.LESS_OR_EQUAL;
|
||||
case GREATER_OR_EQUAL: return Comparator.LESS;
|
||||
case IS_DISTINCT_FROM: return Comparator.IS_NOT_DISTINCT_FROM;
|
||||
case IS_NOT_DISTINCT_FROM: return Comparator.IS_DISTINCT_FROM;
|
||||
case LIKE: return Comparator.NOT_LIKE;
|
||||
case NOT_LIKE: return Comparator.LIKE;
|
||||
case SIMILAR_TO: return Comparator.NOT_SIMILAR_TO;
|
||||
case NOT_SIMILAR_TO: return Comparator.SIMILAR_TO;
|
||||
case LIKE_IGNORE_CASE: return Comparator.NOT_LIKE_IGNORE_CASE;
|
||||
case NOT_LIKE_IGNORE_CASE: return Comparator.LIKE_IGNORE_CASE;
|
||||
default: throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private Condition comparisonCondition(Comparator operator, Field<String> value) {
|
||||
switch (operator) {
|
||||
case LIKE:
|
||||
return escape != null ? field.like(value, escape) : field.like(value);
|
||||
|
||||
case NOT_LIKE:
|
||||
return escape != null ? field.notLike(value, escape) : field.notLike(value);
|
||||
|
||||
case SIMILAR_TO:
|
||||
return escape != null ? field.similarTo(value, escape) : field.similarTo(value);
|
||||
|
||||
case NOT_SIMILAR_TO:
|
||||
return escape != null ? field.notSimilarTo(value, escape) : field.notSimilarTo(value);
|
||||
|
||||
case LIKE_IGNORE_CASE:
|
||||
return escape != null ? field.likeIgnoreCase(value, escape) : field.likeIgnoreCase(value);
|
||||
|
||||
case NOT_LIKE_IGNORE_CASE:
|
||||
return escape != null ? field.notLikeIgnoreCase(value, escape) : field.notLikeIgnoreCase(value);
|
||||
|
||||
default:
|
||||
return ((Field) field).compare(operator, value);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private Condition comparisonCondition(Comparator operator, Object value) {
|
||||
switch (operator) {
|
||||
case LIKE:
|
||||
return escape != null ? field.like(Convert.convert(value, String.class), escape) : field.like(Convert.convert(value, String.class));
|
||||
|
||||
case NOT_LIKE:
|
||||
return escape != null ? field.notLike(Convert.convert(value, String.class), escape) : field.notLike(Convert.convert(value, String.class));
|
||||
|
||||
case SIMILAR_TO:
|
||||
return escape != null ? field.similarTo(Convert.convert(value, String.class), escape) : field.similarTo(Convert.convert(value, String.class));
|
||||
|
||||
case NOT_SIMILAR_TO:
|
||||
return escape != null ? field.notSimilarTo(Convert.convert(value, String.class), escape) : field.notSimilarTo(Convert.convert(value, String.class));
|
||||
|
||||
case LIKE_IGNORE_CASE:
|
||||
return escape != null ? field.likeIgnoreCase(Convert.convert(value, String.class), escape) : field.likeIgnoreCase(Convert.convert(value, String.class));
|
||||
|
||||
case NOT_LIKE_IGNORE_CASE:
|
||||
return escape != null ? field.notLikeIgnoreCase(Convert.convert(value, String.class), escape) : field.notLikeIgnoreCase(Convert.convert(value, String.class));
|
||||
|
||||
default:
|
||||
return ((Field) field).compare(operator, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Clause[] clauses(Context<?> ctx) {
|
||||
return CLAUSES;
|
||||
}
|
||||
}
|
||||
197
jOOQ/src/main/java/org/jooq/impl/SimilarToQuantified.java
Normal file
197
jOOQ/src/main/java/org/jooq/impl/SimilarToQuantified.java
Normal file
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* 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.EqQuantified;
|
||||
import org.jooq.impl.QOM.*;
|
||||
import org.jooq.tools.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>SIMILAR TO</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "hiding", "rawtypes", "unused" })
|
||||
final class SimilarToQuantified
|
||||
extends
|
||||
AbstractCondition
|
||||
implements
|
||||
QOM.SimilarToQuantified,
|
||||
LikeEscapeStep
|
||||
{
|
||||
|
||||
final Field<?> value;
|
||||
final org.jooq.QuantifiedSelect<? extends Record1<String>> pattern;
|
||||
Character escape;
|
||||
|
||||
SimilarToQuantified(
|
||||
Field<?> value,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<String>> pattern
|
||||
) {
|
||||
this(
|
||||
value,
|
||||
pattern,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
SimilarToQuantified(
|
||||
Field<?> value,
|
||||
org.jooq.QuantifiedSelect<? extends Record1<String>> pattern,
|
||||
Character escape
|
||||
) {
|
||||
|
||||
this.value = nullSafeNotNull(value, OTHER);
|
||||
this.pattern = pattern;
|
||||
this.escape = escape;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: DSL API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final SimilarToQuantified escape(char escape) {
|
||||
this.escape = escape;
|
||||
return this;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EqQuantified.acceptCompareCondition(ctx, this, (Field<String>) value, org.jooq.Comparator.SIMILAR_TO, pattern, escape);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Field<?> $arg1() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final org.jooq.QuantifiedSelect<? extends Record1<String>> $arg2() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Character $arg3() {
|
||||
return escape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.SimilarToQuantified $arg1(Field<?> newValue) {
|
||||
return $constructor().apply(newValue, $arg2(), $arg3());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.SimilarToQuantified $arg2(org.jooq.QuantifiedSelect<? extends Record1<String>> newValue) {
|
||||
return $constructor().apply($arg1(), newValue, $arg3());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.SimilarToQuantified $arg3(Character newValue) {
|
||||
return $constructor().apply($arg1(), $arg2(), newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Function3<? super Field<?>, ? super org.jooq.QuantifiedSelect<? extends Record1<String>>, ? super Character, ? extends QOM.SimilarToQuantified> $constructor() {
|
||||
return (a1, a2, a3) -> new SimilarToQuantified(a1, a2, a3);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.SimilarToQuantified o) {
|
||||
return
|
||||
StringUtils.equals($value(), o.$value()) &&
|
||||
StringUtils.equals($pattern(), o.$pattern()) &&
|
||||
StringUtils.equals($escape(), o.$escape())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user