Package org.apache.empire.db.expr.column
Class DBCalcExpr
java.lang.Object
org.apache.empire.db.DBObject
org.apache.empire.db.DBExpr
org.apache.empire.db.DBColumnExpr
org.apache.empire.db.expr.column.DBCalcExpr
- All Implemented Interfaces:
ColumnExpr
This class is used for performing calculations in SQL
It handles the mathematical operations ("+", "-", "*", "/") for the current column.
It handles the mathematical operations ("+", "-", "*", "/") for the current column.
There is no need to explicitly create instances of this class.
Instead use DBColumnExpr.plus(Object), DBColumnExpr.minus(Object),
DBColumnExpr.multiplyWith(Object), DBColumnExpr.divideBy(Object)
-
Field Summary
Fields 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
ConstructorsConstructorDescriptionDBCalcExpr(DBColumnExpr expr, String op, Object value) Constructs a DBCalcExpr object Sets the mathematical operations ("+", "-", "*", "/")
for the specified DBColumnExpr object and value. -
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 adds the mathematical operations for the specified DBColumnExpr object and value to the.This function set the specified mathematical operations to the XML tag.booleanReturns true if other is equal to this expressionfinal DBDatabaseReturns the current DBDatabase object.Returns the data type: DBDataType.DECIMAL.Not an Enum.getName()Returns the given expression name.Returns the underlying rowsetReturns the underlying columnbooleanAlways returns false since CalcExpressions cannot be aggregates.toString()For DebuggingMethods 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, trim, trimLeft, trimRight, trunc, upper, when, yearMethods inherited from class org.apache.empire.db.DBObject
checkParamNull
-
Constructor Details
-
DBCalcExpr
Constructs a DBCalcExpr object Sets the mathematical operations ("+", "-", "*", "/")
for the specified DBColumnExpr object and value.- Parameters:
expr- an DBColumnExpr object, one columnop- the mathematical operation ("+", "-", "*" or "/")value- the value to multiply, divide, sum or subtract
-
-
Method Details
-
getDatabase
Returns the current DBDatabase object.- Specified by:
getDatabasein classDBObject- Returns:
- the current DBDatabase object
-
getDataType
Returns the data type: DBDataType.DECIMAL.- Specified by:
getDataTypein interfaceColumnExpr- Specified by:
getDataTypein classDBColumnExpr- Returns:
- the expressions data type
- See Also:
-
getEnumType
Not an Enum. Returns null- Returns:
- the enum type
-
getName
Returns the given expression name.- Specified by:
getNamein interfaceColumnExpr- Specified by:
getNamein classDBColumnExpr- Returns:
- the column name
-
getRowSet
Returns the underlying rowset- Specified by:
getRowSetin classDBColumnExpr- Returns:
- a column used for this expression
-
getUpdateColumn
Returns the underlying column- Specified by:
getUpdateColumnin interfaceColumnExpr- Specified by:
getUpdateColumnin classDBColumnExpr- Returns:
- the underlying column
-
isAggregate
public boolean isAggregate()Always returns false since CalcExpressions cannot be aggregates.- Specified by:
isAggregatein classDBColumnExpr- Returns:
- false
-
equals
Returns true if other is equal to this 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 adds the mathematical operations for the specified DBColumnExpr object and value to the. SQL-Command -
addXml
This function set the specified mathematical operations to the XML tag.- Specified by:
addXmlin classDBColumnExpr- Parameters:
parent- the parent element to which to append the column descriptionflags- currently not used- Returns:
- the XML tag (with the mathematical operations)
-
toString
Description copied from class:DBColumnExprFor Debugging- Overrides:
toStringin classDBColumnExpr
-