public interface Condition extends QueryPart
Conditions can be used in a variety of SQL clauses. They're mainly used in a
Select
statement's WHERE
clause, but can also appear in
(non-exhaustive list):
SELECT .. WHERE
, e.g. via
SelectWhereStep.where(Condition)
SELECT .. HAVING
, e.g. via
SelectHavingStep.having(Condition)
CASE
expression, e.g. via DSL.case_()
and
Case.when(Condition, Field)
DSL.field(Condition)
AggregateFilterStep.filterWhere(Condition)
Example:
// Assuming import static org.jooq.impl.DSL.*;
using(configuration)
.select()
.from(ACTOR)
.where(ACTOR.ACTOR_ID.eq(1)) // The eq operator produces a Condition from two Fields
.fetch();
Instances can be created using DSL.condition(Field)
and overloads, or
by calling a comparison operator method on Field
, such as
Field.eq(Field)
.
Modifier and Type | Method and Description |
---|---|
@NotNull Condition |
and(Boolean other)
Deprecated.
- 3.8.0 - [#4763] - Use
and(Condition) (typically
with DSL.trueCondition() ,
DSL.falseCondition() , or DSL.noCondition() as
the parameter) or and(Field) instead. Due to
ambiguity between calling this method using
Field.equals(Object) argument, vs. calling the other
method via a Field.equal(Object) argument, this
method will be removed in the future. |
@NotNull Condition |
and(Condition other)
Combine this condition with another one using the
Operator.AND
operator. |
@NotNull Condition |
and(Field<Boolean> other)
Combine this condition with another one using the
Operator.AND
operator. |
@NotNull Condition |
and(SQL sql)
Combine this condition with another one using the
Operator.AND
operator. |
@NotNull Condition |
and(String sql)
Combine this condition with another one using the
Operator.AND
operator. |
@NotNull Condition |
and(String sql,
Object... bindings)
Combine this condition with another one using the
Operator.AND
operator. |
@NotNull Condition |
and(String sql,
QueryPart... parts)
Combine this condition with another one using the
Operator.AND
operator. |
@NotNull Condition |
andExists(Select<?> select)
Combine this condition with an EXISTS clause using the
Operator.AND operator. |
@NotNull Condition |
andNot(Boolean other)
Deprecated.
- 3.8.0 - [#4763] - Use
andNot(Condition) (typically
with DSL.trueCondition() ,
DSL.falseCondition() , or DSL.noCondition() as
the parameter) or andNot(Field) instead. Due to
ambiguity between calling this method using
Field.equals(Object) argument, vs. calling the other
method via a Field.equal(Object) argument, this
method will be removed in the future. |
@NotNull Condition |
andNot(Condition other)
Combine this condition with a negated other one using the
Operator.AND operator. |
@NotNull Condition |
andNot(Field<Boolean> other)
Combine this condition with a negated other one using the
Operator.AND operator. |
@NotNull Condition |
andNotExists(Select<?> select)
Combine this condition with a NOT EXIST clause using the
Operator.AND operator. |
@NotNull Condition |
not()
Invert this condition
This is the same as calling
DSL.not(Condition) |
@NotNull Condition |
or(Boolean other)
Deprecated.
- 3.8.0 - [#4763] - Use
or(Condition) (typically
with DSL.trueCondition() ,
DSL.falseCondition() , or DSL.noCondition() as
the parameter) or or(Field) instead. Due to
ambiguity between calling this method using
Field.equals(Object) argument, vs. calling the other
method via a Field.equal(Object) argument, this
method will be removed in the future. |
@NotNull Condition |
or(Condition other)
Combine this condition with another one using the
Operator.OR
operator. |
@NotNull Condition |
or(Field<Boolean> other)
Combine this condition with another one using the
Operator.OR
operator. |
@NotNull Condition |
or(SQL sql)
Combine this condition with another one using the
Operator.OR
operator. |
@NotNull Condition |
or(String sql)
Combine this condition with another one using the
Operator.OR
operator. |
@NotNull Condition |
or(String sql,
Object... bindings)
Combine this condition with another one using the
Operator.OR
operator. |
@NotNull Condition |
or(String sql,
QueryPart... parts)
Combine this condition with another one using the
Operator.OR
operator. |
@NotNull Condition |
orExists(Select<?> select)
Combine this condition with an EXISTS clause using the
Operator.OR operator. |
@NotNull Condition |
orNot(Boolean other)
Deprecated.
- 3.8.0 - [#4763] - Use
orNot(Condition) (typically
with DSL.trueCondition() ,
DSL.falseCondition() , or DSL.noCondition() as
the parameter) or orNot(Boolean) instead. Due to
ambiguity between calling this method using
Field.equals(Object) argument, vs. calling the other
method via a Field.equal(Object) argument, this
method will be removed in the future. |
@NotNull Condition |
orNot(Condition other)
Combine this condition with a negated other one using the
Operator.OR operator. |
@NotNull Condition |
orNot(Field<Boolean> other)
Combine this condition with a negated other one using the
Operator.OR operator. |
@NotNull Condition |
orNotExists(Select<?> select)
Combine this condition with a NOT EXIST clause using the
Operator.OR operator. |
@NotNull @Support @NotNull Condition and(Condition other)
Operator.AND
operator.other
- The other condition@NotNull @Support @NotNull Condition and(Field<Boolean> other)
Operator.AND
operator.other
- The other condition@Deprecated @NotNull @Support @NotNull Condition and(Boolean other)
and(Condition)
(typically
with DSL.trueCondition()
,
DSL.falseCondition()
, or DSL.noCondition()
as
the parameter) or and(Field)
instead. Due to
ambiguity between calling this method using
Field.equals(Object)
argument, vs. calling the other
method via a Field.equal(Object)
argument, this
method will be removed in the future.Operator.AND
operator.other
- The other condition@NotNull @Support @PlainSQL @NotNull Condition and(SQL sql)
Operator.AND
operator.
NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
sql
- The other conditionDSL.condition(SQL)
,
SQL
@NotNull @Support @PlainSQL @NotNull Condition and(String sql)
Operator.AND
operator.
NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
sql
- The other conditionDSL.condition(String)
,
SQL
@NotNull @Support @PlainSQL @NotNull Condition and(String sql, Object... bindings)
Operator.AND
operator.
NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
sql
- The other conditionbindings
- The bindingsDSL.condition(String, Object...)
,
DSL.sql(String, Object...)
,
SQL
@NotNull @Support @PlainSQL @NotNull Condition and(String sql, QueryPart... parts)
Operator.AND
operator.
NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
sql
- The SQL clause, containing {numbered placeholders} where query
parts can be injectedparts
- The QueryPart
objects that are rendered at the
{numbered placeholder} locationsDSL.condition(String, QueryPart...)
,
DSL.sql(String, QueryPart...)
,
SQL
@NotNull @Support @NotNull Condition andNot(Condition other)
Operator.AND
operator.other
- The other condition@NotNull @Support @NotNull Condition andNot(Field<Boolean> other)
Operator.AND
operator.other
- The other condition@Deprecated @NotNull @Support @NotNull Condition andNot(Boolean other)
andNot(Condition)
(typically
with DSL.trueCondition()
,
DSL.falseCondition()
, or DSL.noCondition()
as
the parameter) or andNot(Field)
instead. Due to
ambiguity between calling this method using
Field.equals(Object)
argument, vs. calling the other
method via a Field.equal(Object)
argument, this
method will be removed in the future.Operator.AND
operator.other
- The other condition@NotNull @Support @NotNull Condition andExists(Select<?> select)
Operator.AND
operator.select
- The EXISTS's subquery@NotNull @Support @NotNull Condition andNotExists(Select<?> select)
Operator.AND
operator.select
- The EXISTS's subquery@NotNull @Support @NotNull Condition or(Condition other)
Operator.OR
operator.other
- The other condition@NotNull @Support @NotNull Condition or(Field<Boolean> other)
Operator.OR
operator.other
- The other condition@Deprecated @NotNull @Support @NotNull Condition or(Boolean other)
or(Condition)
(typically
with DSL.trueCondition()
,
DSL.falseCondition()
, or DSL.noCondition()
as
the parameter) or or(Field)
instead. Due to
ambiguity between calling this method using
Field.equals(Object)
argument, vs. calling the other
method via a Field.equal(Object)
argument, this
method will be removed in the future.Operator.OR
operator.other
- The other condition@NotNull @Support @PlainSQL @NotNull Condition or(SQL sql)
Operator.OR
operator.
NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
sql
- The other conditionDSL.condition(SQL)
,
SQL
@NotNull @Support @PlainSQL @NotNull Condition or(String sql)
Operator.OR
operator.
NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
sql
- The other conditionDSL.condition(String)
,
SQL
@NotNull @Support @PlainSQL @NotNull Condition or(String sql, Object... bindings)
Operator.OR
operator.
NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
sql
- The other conditionbindings
- The bindingsDSL.condition(String, Object...)
,
DSL.sql(String, Object...)
,
SQL
@NotNull @Support @PlainSQL @NotNull Condition or(String sql, QueryPart... parts)
Operator.OR
operator.
NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
sql
- The SQL clause, containing {numbered placeholders} where query
parts can be injectedparts
- The QueryPart
objects that are rendered at the
{numbered placeholder} locationsDSL.condition(String, Object...)
,
DSL.sql(String, QueryPart...)
,
SQL
@NotNull @Support @NotNull Condition orNot(Condition other)
Operator.OR
operator.other
- The other condition@NotNull @Support @NotNull Condition orNot(Field<Boolean> other)
Operator.OR
operator.other
- The other condition@Deprecated @NotNull @Support @NotNull Condition orNot(Boolean other)
orNot(Condition)
(typically
with DSL.trueCondition()
,
DSL.falseCondition()
, or DSL.noCondition()
as
the parameter) or orNot(Boolean)
instead. Due to
ambiguity between calling this method using
Field.equals(Object)
argument, vs. calling the other
method via a Field.equal(Object)
argument, this
method will be removed in the future.Operator.OR
operator.other
- The other condition@NotNull @Support @NotNull Condition orExists(Select<?> select)
Operator.OR
operator.select
- The EXISTS's subquery@NotNull @Support @NotNull Condition orNotExists(Select<?> select)
Operator.OR
operator.select
- The EXISTS's subquery@NotNull @Support @NotNull Condition not()
This is the same as calling DSL.not(Condition)
Copyright © 2020. All rights reserved.