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

java.lang.Object
  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:
Serializable

public class DBSetExpr
extends DBExpr

This class is used for building a set expression of a 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" ));

See Also:
Serialized Form

Field Summary
 DBColumn column
           
 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, Object value)
          Constructs a new DBSetExpr object.
 
Method Summary
 void addReferencedColumns(Set<DBColumn> list)
          Internal function to obtain all DBColumnExpr-objects used by this expression.
 void addSQL(StringBuilder buf, long context)
          Creates the SQL-Command.
 DBColumn getColumn()
           
 DBDatabase getDatabase()
          Returns the current DBDatabase object.
 DBRowSet getTable()
          Returns the current Table object.
 Object getValue()
           
 void setValue(Object value)
          The value to which to set the column
 
Methods inherited from class org.apache.empire.db.DBExpr
getObjectValue, getValueClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

column

public final DBColumn column

value

public Object value
Constructor Detail

DBSetExpr

public DBSetExpr(DBColumn expr,
                 Object value)
Constructs a new DBSetExpr object.

Parameters:
expr - the column
value - the value
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 Table object.

Returns:
the current DBRowSet object

getColumn

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

getValue

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

setValue

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

Parameters:
value - the new column value

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

addSQL

public void addSQL(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


Copyright © 2008–2014 Apache Software Foundation. All rights reserved.