Package org.apache.empire.db.expr.column
Class DBValueExpr
java.lang.Object
org.apache.empire.db.DBObject
org.apache.empire.db.DBExpr
org.apache.empire.db.DBColumnExpr
org.apache.empire.db.expr.column.DBValueExpr
- All Implemented Interfaces:
ColumnExpr,DBPreparable
This class is used for declaring constant values in SQL.
There is no need to explicitly create instances of this class.
Instead use DBDatabase.getValueExpr(String) or one of it's overloads
-
Field Summary
FieldsFields inherited from class org.apache.empire.db.DBColumnExpr
attributes, beanPropertyName, optionsFields inherited from class org.apache.empire.db.DBExpr
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESIS, CTX_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionDBValueExpr(DBDatabase db, Object value, DataType type) Deprecated.please use DBDatabase.getValueExpr(...) -
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.this helper function calls the DBColumnExpr.addXML(Element, long) methodSets literal mode off, i.e. the value may passed as a parameter and referenced by a ?booleanReturns true if other is equal to this expressionfinal DBDatabaseReturns the current DBDatabase object.Returns the data type of the DBColumnExpr object.Returns the EnumType if the value is an EnumgetIgnoreCaseExpr(DBColumnExpr context) Returns an expression which ignores the case Only for case sensitive columns!getName()Returns the column name.Returns null.Returns null.getValue()return the value associated with this value expressionbooleanAlways returns false since value expressions cannot be an aggregate.literal()Set literal mode, i.e. the value will be placed in the sql statement Otherwise it may be automatically replaced by a parameter ?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.voidset the value associated with this value expressionMethods inherited from class org.apache.empire.db.DBColumnExpr
abs, aggregate, append, as, as, asc, avg, ceiling, cmp, coalesce, concat, concat, contains, convertTo, convertTo, count, countDistinct, day, decode, decode, decode, decode, decode, decode, decodeEnum, decodeSort, desc, divideBy, floor, format, function, getAttribute, getAttribute, getBeanPropertyName, getControlType, getDefaultSortOrder, getExprFromPhrase, getExprFromPhrase, getIgnoreCaseExpr, getJavaType, getNumberType, getOptions, getSourceColumn, getTitle, in, in, in, indexOf, indexOf, indexOf, is, isBetween, isCaseSensitive, isGreaterThan, isLessOrEqual, isLiteralValue, isMoreOrEqual, isNot, isNotBetween, isSmallerThan, length, like, like, likeLower, likeUpper, lower, max, min, minus, minus, modulo, month, multiplyWith, notContains, notIn, notIn, notIn, notLike, nvl, on, parenthesis, plus, plus, prepend, qualified, replace, reverse, round, setAttribute, setBeanPropertyName, setControlType, setDefaultSortOrder, setOptions, setTitle, stringAgg, stringAgg, substring, substring, substring, substring, substring, substring, sum, toChar, toChar, toString, trim, trimLeft, trimRight, trunc, upper, when, yearMethods inherited from class org.apache.empire.db.DBObject
checkParamNull
-
Field Details
-
IGNORE_CASE_CONTEXT
-
db
-
type
-
value
-
-
Constructor Details
-
DBValueExpr
Deprecated.please use DBDatabase.getValueExpr(...) The constructor will be made protected in future versionsConstructs a new DBValueExpr object.- Parameters:
db- the databasevalue- the value for this constanttype- the data type for this constant
-
-
Method Details
-
getValue
return the value associated with this value expression- Returns:
- the current value
-
setValue
set the value associated with this value expression- Parameters:
value- the value to set
-
getDatabase
Returns the current DBDatabase object.- Specified by:
getDatabasein classDBObject- Returns:
- the current DBDatabase object
-
getDataType
Returns the data type of the DBColumnExpr object.- Specified by:
getDataTypein interfaceColumnExpr- Specified by:
getDataTypein classDBColumnExpr- Returns:
- the data type
- See Also:
-
getEnumType
Returns the EnumType if the value is an Enum- Specified by:
getEnumTypein interfaceColumnExpr- Returns:
- the enum type
-
getName
Returns the column name.- Specified by:
getNamein interfaceColumnExpr- Specified by:
getNamein classDBColumnExpr- Returns:
- the column name
-
getRowSet
Returns null.- Specified by:
getRowSetin classDBColumnExpr- Returns:
- null
-
getUpdateColumn
Returns null.- Specified by:
getUpdateColumnin interfaceColumnExpr- Specified by:
getUpdateColumnin classDBColumnExpr- Returns:
- null
-
isAggregate
public boolean isAggregate()Always returns false since value expressions cannot be an aggregate.- Specified by:
isAggregatein classDBColumnExpr- Returns:
- false
-
equals
Returns true if other is equal to this expression -
getIgnoreCaseExpr
Returns an expression which ignores the case Only for case sensitive columns! Default is upper(expr)- Parameters:
context- the column context- Returns:
- the ignore case expression or the expression itself
-
literal
Set literal mode, i.e. the value will be placed in the sql statement Otherwise it may be automatically replaced by a parameter ?- Returns:
- self (this)
-
autoParam
Sets literal mode off, i.e. the value may passed as a parameter and referenced by a ? in the sql statement- Returns:
- self (this)
-
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!- Specified by:
prepareParamsin interfaceDBPreparable- Parameters:
cmd- the command to which to add the parametersparent- the parent expression holding the value
-
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. -
addXml
this helper function calls the DBColumnExpr.addXML(Element, long) method- Specified by:
addXmlin classDBColumnExpr- Parameters:
parent- the parent element to which to append the column descriptionflags- currently not used- Returns:
- the newly created child element
-