Class DBCompareAndOrExpr
java.lang.Object
org.apache.empire.db.DBObject
org.apache.empire.db.DBExpr
org.apache.empire.db.expr.compare.DBCompareExpr
org.apache.empire.db.expr.compare.DBCompareAndOrExpr
- All Implemented Interfaces:
DBPreparable
This class is used for combining two filter constraints by and / or operator
There is no need to explicitly create instances of this class.
Instead use DBCompareExpr.and(DBCompareExpr) or DBCompareExpr.or(DBCompareExpr)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DBCompareExprprotected final booleanprotected final DBCompareExprFields inherited from class org.apache.empire.db.expr.compare.DBCompareExpr
logFields inherited from class org.apache.empire.db.DBExpr
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESIS, CTX_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionDBCompareAndOrExpr(DBCompareExpr left, DBCompareExpr right, boolean or) Constructs a DBCompareColExpr object -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReferencedColumns(Set<DBColumn> list) Internal function to obtain all DBColumnExpr-objects used by this expression.voidaddSQL(DBSQLBuilder sql, long context) Creates the SQL-Command sets the specified compare value (the varible boolOP) between the two DBCompareExpr objects.Copy Commandfinal DBDatabaseReturns the current DBDatabase object.getLeft()getRight()Returns the underlying rowset containing this columnbooleanisConstraintOn(DBColumnExpr colExpr) Returns whether the constraint is on the given columnbooleanisMutuallyExclusive(DBCompareExpr other) Returns whether the constraint should replace another one or not.booleanisOr()wraps the current expression with parenthesis.voidprepareParams(DBCommand cmd, DBExpr parent) Prepares an expression for a query This function is called by DBCommand in order to add values as query parameters instead of being literally included in the sql statement Please Note: This function is internally called.toString()For DebuggingMethods inherited from class org.apache.empire.db.expr.compare.DBCompareExpr
and, not, orMethods inherited from class org.apache.empire.db.DBObject
checkParamNull
-
Field Details
-
left
-
right
-
or
protected final boolean or
-
-
Constructor Details
-
DBCompareAndOrExpr
Constructs a DBCompareColExpr object- Parameters:
left- the left side of the expressionright- the right side of the expressionor- true for OR operation, false for AND
-
-
Method Details
-
getLeft
-
getRight
-
isOr
public boolean isOr() -
getDatabase
Returns the current DBDatabase object.- Specified by:
getDatabasein classDBObject- Returns:
- the current DBDatabase object
-
getRowSet
Returns the underlying rowset containing this column- Specified by:
getRowSetin classDBCompareExpr- Returns:
- a column used for this expression
-
prepareParams
Description copied from interface:DBPreparablePrepares an expression for a query This function is called by DBCommand in order to add values as query parameters instead of being literally included in the sql statement Please Note: This function is internally called. Do not call yourself!- Parameters:
cmd- the command to which to add the parametersparent- the parent expression holding the value
-
copy
Copy Command- Specified by:
copyin classDBCompareExpr- Parameters:
newCmd- the new command object- Returns:
- the cloned compare expression
-
addReferencedColumns
Description copied from class:DBExprInternal function to obtain all DBColumnExpr-objects used by this expression.- Specified by:
addReferencedColumnsin classDBExpr- Parameters:
list- list to which all used column expressions must be added- See Also:
-
addSQL
Creates the SQL-Command sets the specified compare value (the varible boolOP) between the two DBCompareExpr objects. -
toString
For Debugging -
isMutuallyExclusive
Returns whether the constraint should replace another one or not.- Specified by:
isMutuallyExclusivein classDBCompareExpr- Returns:
- true it the constraints are mutually exclusive or false otherwise
-
isConstraintOn
Returns whether the constraint is on the given column- Specified by:
isConstraintOnin classDBCompareExpr- Returns:
- true it the constraint is on the given column or false otherwise
-
parenthesis
wraps the current expression with parenthesis.- Returns:
- the new DBCompareColExpr object
-