Class DBCmdParam


public class DBCmdParam extends DBExpr
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 Details

  • Constructor Details

    • DBCmdParam

      protected DBCmdParam(DBCommand cmd, DataType type, Object value)
      Protected constructor used e.g. by DBCommand.addParam(...)
      Parameters:
      cmd - the command to which this DBCommand belongs to
      type - the parameter data type
      value - the initial value (can be changed any time by calling setValue(...))
  • Method Details

    • getValueExpr

      public DBValueExpr getValueExpr(DBDatabase db)
      Returns a value expression for this param
      Parameters:
      db - the database
      Returns:
      the value expression
    • getCmdParamValue

      protected Object getCmdParamValue(Object value)
      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

      public void addSQL(DBSQLBuilder sql, long context)
      Description copied from class: DBExpr
      Used to build the SQL command. SQL for this expression must be appended to StringBuilder.
      Specified by:
      addSQL in class DBExpr
      Parameters:
      sql - the string buffer used to build the sql command
      context - context flag for this SQL-Command (see CTX_??? constants).
    • addReferencedColumns

      public void addReferencedColumns(Set<DBColumn> list)
      Description copied from class: DBExpr
      Internal function to obtain all DBColumnExpr-objects used by this expression.
      Specified by:
      addReferencedColumns in class DBExpr
      Parameters:
      list - list to which all used column expressions must be added
      See Also:
    • getDatabase

      public final DBDatabase getDatabase()
      Description copied from class: DBObject
      Returns the database object to which this object belongs to. For the database object itself this function will return the this pointer.
      Specified by:
      getDatabase in class DBObject
      Returns:
      the database object
    • getCmd

      public DBCommand getCmd()
      Returns the command this parameter belongs to
      Returns:
      the command
    • getDataType

      public DataType getDataType()
      Returns the data type of the command parameter
      Returns:
      the data type
    • getValue

      public Object 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

      public void setValue(Object value)
      Sets the current value of the parameter
      Parameters:
      value - the new value
    • getReference

      public Object getReference()
      Returns the reference object associated with this param
      Returns:
      the reference object or null
    • setReference

      public DBCmdParam setReference(Object reference)
      Sets a reference object associated with this param
      Parameters:
      reference - the reference object
      Returns:
      this object