Package org.apache.empire.db
Class DBCmdParam
java.lang.Object
org.apache.empire.db.DBObject
org.apache.empire.db.DBExpr
org.apache.empire.db.DBCmdParam
This class defines a parameter for a prepared statement query.
Do not create instances of this class yourself, rather use DBCommand.addParam(...)
- Author:
- Rainer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBCommandprotected Objectprotected DataTypeprotected ObjectFields inherited from class org.apache.empire.db.DBExpr
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESIS, CTX_VALUE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDBCmdParam(DBCommand cmd, DataType type, Object value) Protected constructor used e.g. by DBCommand.addParam(...) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReferencedColumns(Set<DBColumn> list) Internal function to obtain all DBColumnExpr-objects used by this expression.voidaddSQL(DBSQLBuilder sql, long context) Used to build the SQL command.getCmd()Returns the command this parameter belongs toprotected ObjectgetCmdParamValue(Object value) Returns the internal parameter value for a given "real" value.final DBDatabaseReturns the database object to which this object belongs to.Returns the data type of the command parameterReturns the reference object associated with this paramgetValue()Returns the current value of the parameter.Returns a value expression for this paramsetReference(Object reference) Sets a reference object associated with this paramvoidSets the current value of the parameterMethods inherited from class org.apache.empire.db.DBObject
checkParamNull
-
Field Details
-
cmd
-
type
-
value
-
reference
-
-
Constructor Details
-
DBCmdParam
Protected constructor used e.g. by DBCommand.addParam(...)- Parameters:
cmd- the command to which this DBCommand belongs totype- the parameter data typevalue- the initial value (can be changed any time by calling setValue(...))
-
-
Method Details
-
getValueExpr
Returns a value expression for this param- Parameters:
db- the database- Returns:
- the value expression
-
getCmdParamValue
Returns the internal parameter value for a given "real" value. Depending on the data type this might involve wrapping the real value with another class. This is done e.g. for CLOBs and BLOBs- Parameters:
value- the "real" value- Returns:
- the (possibly wrapped) value
-
addSQL
Description copied from class:DBExprUsed to build the SQL command. SQL for this expression must be appended to StringBuilder. -
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:
-
getDatabase
Description copied from class:DBObjectReturns the database object to which this object belongs to. For the database object itself this function will return the this pointer.- Specified by:
getDatabasein classDBObject- Returns:
- the database object
-
getCmd
Returns the command this parameter belongs to- Returns:
- the command
-
getDataType
Returns the data type of the command parameter- Returns:
- the data type
-
getValue
Returns the current value of the parameter. In some cases (as for CLOBs and BLOBs) this might return a Wrapper class for the underlying value.- Returns:
- the current (possibly wrapped) value
-
setValue
Sets the current value of the parameter- Parameters:
value- the new value
-
getReference
Returns the reference object associated with this param- Returns:
- the reference object or null
-
setReference
Sets a reference object associated with this param- Parameters:
reference- the reference object- Returns:
- this object
-