Class DBCompareColExpr
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.DBCompareColExpr
- All Implemented Interfaces:
DBPreparable
This class is used for defining filter constraints based on a column expression in SQL
There is no need to explicitly create instances of this class.
Instead use any of the following functions:
DBColumnExpr.is(Object), DBColumnExpr.isBetween(Object, Object), DBColumnExpr.isGreaterThan(Object),
DBColumnExpr.isLessOrEqual(Object), DBColumnExpr.isMoreOrEqual(Object), DBColumnExpr.isNot(Object),
DBColumnExpr.isNotBetween(Object, Object), DBColumnExpr.isSmallerThan(Object), DBColumnExpr.like(Object),
DBColumnExpr.like(String, char), DBColumnExpr.likeLower(String), DBColumnExpr.likeUpper(String)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DBCmpTypeprotected final DBColumnExprprotected DBFuncExprprotected booleanprotected ObjectFields 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
ConstructorsConstructorDescriptionDBCompareColExpr(DBColumnExpr expr, DBCmpType op, Object value) Constructs a DBCompareColExpr object set the specified parameters to this object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompareExpr(DBSQLBuilder sql, long context) Add the comparison operator and value to the SQL-Command.voidaddReferencedColumns(Set<DBColumn> list) Internal function to obtain all DBColumnExpr-objects used by this expression.voidaddSQL(DBSQLBuilder sql, long context) Creates the SQL-Command.Copy CommandGets the comparison operatorGets the DBColumnExpr objectfinal DBDatabaseReturns the current DBDatabase object.Returns the underlying rowset containing this columngetValue()Gets the value to compare the column expression withbooleanisConstraintOn(DBColumnExpr colExpr) Returns whether the constraint is on the given columnbooleanisMutuallyExclusive(DBCompareExpr other) Returns whether the constraint should replace another one or not.wraps the expression in ParenthesisvoidprepareParams(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.voidThe value to compare the column expression withtoString()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
-
expr
-
cmpop
-
value
-
parenthesis
protected boolean parenthesis -
function
-
-
Constructor Details
-
DBCompareColExpr
Constructs a DBCompareColExpr object set the specified parameters to this object.- Parameters:
expr- the DBColumnExpr objectop- the comparative context e.g. (CMP_EQUAL, CMP_SMALLER)value- the comparative value
-
-
Method Details
-
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
-
getColumnExpr
Gets the DBColumnExpr object- Returns:
- the DBColumnExpr object
-
getCmpOperator
Gets the comparison operator- Returns:
- the comparison operator
-
getValue
Gets the value to compare the column expression with- Returns:
- the value to compare the column expression with
-
setValue
The value to compare the column expression with- Parameters:
value- the comparison value
-
parenthesis
wraps the expression in Parenthesis- Returns:
- the parenthesis 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:
-
addCompareExpr
Add the comparison operator and value to the SQL-Command.- Parameters:
sql- the SQL-Commandcontext- the comparative context e.g. (CMP_EQUAL, CMP_SMALLER)
-
addSQL
Creates the SQL-Command. -
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
-