org.apache.empire.db.expr.set
Class DBSetExpr

java.lang.Object
  extended by org.apache.empire.commons.ErrorObject
      extended by org.apache.empire.db.DBObject
          extended by org.apache.empire.db.DBExpr
              extended by org.apache.empire.db.expr.set.DBSetExpr
All Implemented Interfaces:
ErrorInfo

public class DBSetExpr
extends DBExpr

This class is used for building a set expression of an SQL update statement.

There is no need to explicitly create instances of this class.
Instead use DBColumn.to(Object) factory method.

For the SQL fragment "set name="foo"
you should write: cmd.set( TABLE.NAME.to( "foo" ));


Field Summary
 DBColumn column
           
 java.lang.Object value
           
 
Fields inherited from class org.apache.empire.db.DBExpr
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESES, CTX_VALUE
 
Constructor Summary
DBSetExpr(DBColumn expr, java.lang.Object value)
          Constructs a new DBSetExpr object.
 
Method Summary
 void addReferencedColumns(java.util.Set<DBColumn> list)
          Internal function to obtain all DBColumnExpr-objects used by this expression.
 void addSQL(java.lang.StringBuilder buf, long context)
          Creates the SQL-Command.
 DBColumn getColumn()
           
 DBDatabase getDatabase()
          Returns the current DBDatabase object.
 DBRowSet getTable()
          Returns the current DBDatabase object.
 java.lang.Object getValue()
           
 void setValue(java.lang.Object value)
          The value to which to set the column
 
Methods inherited from class org.apache.empire.db.DBExpr
getValueClass
 
Methods inherited from class org.apache.empire.commons.ErrorObject
clearError, getErrorMessage, getErrorParams, getErrorSource, getErrorType, getMessage, hasError, isExceptionsEnabled, setExceptionsEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

column

public final DBColumn column

value

public java.lang.Object value
Constructor Detail

DBSetExpr

public DBSetExpr(DBColumn expr,
                 java.lang.Object value)
Constructs a new DBSetExpr object. Sets the specified parameters to this object.

Method Detail

getDatabase

public DBDatabase getDatabase()
Returns the current DBDatabase object.

Specified by:
getDatabase in class DBObject
Returns:
the current DBDatabase object

getTable

public DBRowSet getTable()
Returns the current DBDatabase object.

Returns:
the current DBDatabase object

getColumn

public DBColumn getColumn()
Returns:
the column which value should be set

getValue

public java.lang.Object getValue()
Returns:
the value to which to set the column to

setValue

public void setValue(java.lang.Object value)
The value to which to set the column

Parameters:
value - the new column value

addReferencedColumns

public void addReferencedColumns(java.util.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:
DBExpr.addReferencedColumns(Set)

addSQL

public void addSQL(java.lang.StringBuilder buf,
                   long context)
Creates the SQL-Command.

Specified by:
addSQL in class DBExpr
Parameters:
buf - the SQL-Command
context - the current SQL-Command context