AstVisitor, Conditionspublic final class ConditionsImpl extends java.lang.Object implements Conditions
| Constructor | Description |
|---|---|
ConditionsImpl(NodeMetadata metadata,
Query query) |
It is used
|
ConditionsImpl(NodeMetadata metadata,
Expression field,
Conditions conditions) |
Ordinarily this constructor is used by
BETWEEN .. |
ConditionsImpl(Conditions conditions) |
|
ConditionsImpl(Expression field,
NodeMetadata metadata,
Query query) |
|
ConditionsImpl(Expression leftValue,
NodeMetadata metadata,
Expression rightValue) |
| Modifier and Type | Method | Description |
|---|---|---|
Conditions |
and(Conditions conditions) |
This function useful in a few case:
When the
conditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc. |
<T> Conditions |
and(T leftValue,
T operator,
T rightValue) |
Example:
// SELECT * FROM book WHERE year > 2010 AND "id" = 1
select("*")
.from("book")
.where("year", ">", "2010")
.and(asQuotedName("id"), operator("="), asNumber(1))
.sql()
|
Conditions |
andExists(Query query) |
Example:
// SELECT * FROM book WHERE year > 2010 AND EXISTS (SELECT * FROM author)
select("*")
.from("book")
.where("year", ">", "2010")
.andExists(select("*").from("authors"))
.sql()
|
Conditions |
andNot(Conditions conditions) |
This function useful in a few case:
When the
conditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc. |
<T> Conditions |
andNot(T leftValue,
T operator,
T rightValue) |
Example:
// SELECT * FROM book WHERE year > 2010 AND NOT "id" = 1
select("*")
.from("book")
.where("year", ">", "2010")
.andNot(asQuotedName("id"), operator("="), asNumber(1))
.sql()
|
Conditions |
andNotExists(Query query) |
Example:
// SELECT * FROM book WHERE year > 2010 AND NOT EXISTS (SELECT * FROM author)
select("*")
.from("book")
.where("year", ">", "2010")
.andNotExists(select("*").from("authors"))
.sql()
|
void |
assemble(AbstractSyntaxTree tree) |
Visits SQL query making a tree from its clauses.
|
Node |
getNode() |
|
Conditions |
or(Conditions conditions) |
This function useful in a few case:
When the
conditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc. |
<T> Conditions |
or(T leftValue,
T operator,
T rightValue) |
Example:
// SELECT * FROM book WHERE year > 2010 OR id = 1
select("*")
.from("book")
.where("year", ">", "2010")
.or("id", "=", "1")
.sql()
|
Conditions |
orExists(Query query) |
Example:
// SELECT * FROM book WHERE year > 2010 OR EXISTS (SELECT * FROM author)
select("*")
.from("book")
.where("year", ">", "2010")
.orExists(select("*").from("authors"))
.sql()
|
Conditions |
orNot(Conditions conditions) |
This function useful in a few case:
When the
conditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc. |
<T> Conditions |
orNot(T leftValue,
T operator,
T rightValue) |
Example:
// SELECT * FROM book WHERE year > 2010 OR NOT "id" = 1
select("*")
.from("book")
.where("year", ">", "2010")
.orNot(asQuotedName("id"), "=", 1)
.sql()
|
Conditions |
orNotExists(Query query) |
Example:
// SELECT * FROM book WHERE year > 2010 OR NOT EXISTS (SELECT * FROM author)
select("*")
.from("book")
.where("year", ">", "2010")
.orNotExists(select("*").from("authors"))
.sql()
|
public ConditionsImpl(Expression leftValue, NodeMetadata metadata, Expression rightValue)
public ConditionsImpl(NodeMetadata metadata, Expression field, Conditions conditions)
BETWEEN .. AND ..
clause.
Where:
metadata - - BETWEEN node metadata.field - - field of between. Example: id BETWEEN ..conditions - - condition of between. Example: id BETWEEN 1 AND 20public ConditionsImpl(Conditions conditions)
public ConditionsImpl(NodeMetadata metadata, Query query)
query - public ConditionsImpl(Expression field, NodeMetadata metadata, Query query)
public final <T> Conditions and(T leftValue, T operator, T rightValue)
Conditions
// SELECT * FROM book WHERE year > 2010 AND "id" = 1
select("*")
.from("book")
.where("year", ">", "2010")
.and(asQuotedName("id"), operator("="), asNumber(1))
.sql()
and in interface ConditionsT - String, Expression, Operator or Query objectleftValue - left operandoperator - operatorrightValue - right operandpublic final Conditions and(Conditions conditions)
Conditionsconditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc.
See the first example.
conditions is conditions are joined by AND, AND NOT,
OR and OR NOT operators. These conditions is being a grouped condition,
and will be surrounded by parentheses.
See the second example.
// SELECT * FROM book WHERE year > 2010 AND id BETWEEN 1 AND 10
select("*")
.from("book")
.where("year", ">", "2010")
.and(conditionBetween("id", "1", "10"))
.sql()
The second example:
// SELECT * FROM book WHERE year > 2010 AND (id BETWEEN 1 AND 10 AND name = 'Advanced SQL')
select("*")
.from("book")
.where("year", ">", "2010")
.and(
conditionBetween("id", "1", "10")
.and(asName("name"), operator("="), asString("Advanced SQL"))
)
.sql()
and in interface Conditionsconditions - conditionQueryman.condition(Object, Object, Object)public final Conditions andExists(Query query)
Conditions
// SELECT * FROM book WHERE year > 2010 AND EXISTS (SELECT * FROM author)
select("*")
.from("book")
.where("year", ">", "2010")
.andExists(select("*").from("authors"))
.sql()
andExists in interface Conditionsquery - subquerypublic final <T> Conditions andNot(T leftValue, T operator, T rightValue)
Conditions
// SELECT * FROM book WHERE year > 2010 AND NOT "id" = 1
select("*")
.from("book")
.where("year", ">", "2010")
.andNot(asQuotedName("id"), operator("="), asNumber(1))
.sql()
andNot in interface ConditionsT - String, Expression, Operator or Query objectleftValue - left operandoperator - operatorrightValue - right operandpublic final Conditions andNot(Conditions conditions)
Conditionsconditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc.
See the first example.
conditions is conditions are joined by AND, AND NOT,
OR and OR NOT operators. These conditions is being a grouped condition,
and will be surrounded by parentheses.
See the second example.
// SELECT * FROM book WHERE year > 2010 AND NOT id BETWEEN 1 AND 10
select("*")
.from("book")
.where("year", ">", "2010")
.andNot(conditionBetween("id", "1", "10"))
.sql()
The second example:
// SELECT * FROM book WHERE year > 2010 AND NOT (id BETWEEN 1 AND 10 AND name = 'Advanced SQL')
select("*")
.from("book")
.where("year", ">", "2010")
.andNot(
conditionBetween("id", "1", "10")
..and(asName("name"), operator("="), asString("Advanced SQL"))
)
.sql()
andNot in interface Conditionsconditions - conditionQueryman.condition(Object, Object, Object)public final Conditions andNotExists(Query query)
Conditions
// SELECT * FROM book WHERE year > 2010 AND NOT EXISTS (SELECT * FROM author)
select("*")
.from("book")
.where("year", ">", "2010")
.andNotExists(select("*").from("authors"))
.sql()
andNotExists in interface Conditionsquery - subquerypublic final <T> Conditions or(T leftValue, T operator, T rightValue)
Conditions
// SELECT * FROM book WHERE year > 2010 OR id = 1
select("*")
.from("book")
.where("year", ">", "2010")
.or("id", "=", "1")
.sql()
or in interface ConditionsT - String, Expression, Operator or Query objectleftValue - left operandoperator - operatorrightValue - right operandpublic final Conditions or(Conditions conditions)
Conditionsconditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc.
See the first example.
conditions is conditions are joined by AND, AND NOT,
OR and OR NOT operators. These conditions is being a grouped condition,
and will be surrounded by parentheses.
See the second example.
// SELECT * FROM book WHERE year > 2010 OR id BETWEEN 1 AND 10
select("*")
.from("book")
.where("year", ">", "2010")
.or(conditionBetween("id", "1", "10"))
.sql()
The second example:
// SELECT * FROM book WHERE year > 2010 OR (id BETWEEN 1 AND 10 AND name = 'Advanced SQL')
select("*")
.from("book")
.where("year", ">", "2010")
.ir(
conditionBetween("id", "1", "10")
..and(asName("name"), operator("="), asString("Advanced SQL"))
)
.sql()
or in interface Conditionsconditions - conditionQueryman.condition(Object, Object, Object)public final Conditions orExists(Query query)
Conditions
// SELECT * FROM book WHERE year > 2010 OR EXISTS (SELECT * FROM author)
select("*")
.from("book")
.where("year", ">", "2010")
.orExists(select("*").from("authors"))
.sql()
orExists in interface Conditionsquery - subquerypublic final <T> Conditions orNot(T leftValue, T operator, T rightValue)
Conditions
// SELECT * FROM book WHERE year > 2010 OR NOT "id" = 1
select("*")
.from("book")
.where("year", ">", "2010")
.orNot(asQuotedName("id"), "=", 1)
.sql()
orNot in interface ConditionsT - String, Expression, Operator or Query objectleftValue - left operandoperator - operatorrightValue - right operandpublic final Conditions orNot(Conditions conditions)
Conditionsconditions is a special case of condition,
like Queryman.conditionBetween(Object, Object, Object), or
Queryman.conditionSome(Object, Object, Query) etc.
See the first example.
conditions is conditions are joined by AND, AND NOT,
OR and OR NOT operators. These conditions is being a grouped condition,
and will be surrounded by parentheses.
See the second example.
// SELECT * FROM book WHERE year > 2010 OR NOT id BETWEEN 1 AND 10
select("*")
.from("book")
.where("year", ">", "2010")
.orNot(conditionBetween("id", "1", "10"))
.sql()
The second example:
// SELECT * FROM book WHERE year > 2010 OR NOT (id BETWEEN 1 AND 10 AND name = 'Advanced SQL')
select("*")
.from("book")
.where("year", ">", "2010")
.orNot(
conditionBetween("id", "1", "10")
..and(asName("name"), operator("="), asString("Advanced SQL"))
)
.sql()
orNot in interface Conditionsconditions - conditionQueryman.condition(Object, Object, Object)public final Conditions orNotExists(Query query)
Conditions
// SELECT * FROM book WHERE year > 2010 OR NOT EXISTS (SELECT * FROM author)
select("*")
.from("book")
.where("year", ">", "2010")
.orNotExists(select("*").from("authors"))
.sql()
orNotExists in interface Conditionsquery - subquerypublic Node getNode()
getNode in interface Conditionspublic void assemble(AbstractSyntaxTree tree)
AstVisitorassemble in interface AstVisitortree - - abstract syntax tree