org.castor.cpa.persistence.sql.query
Class Update

java.lang.Object
  extended by org.castor.cpa.persistence.sql.query.QueryObject
      extended by org.castor.cpa.persistence.sql.query.Update

public final class Update
extends QueryObject

Class to generate SQL update query statements.
Note: Be aware that the SQL statement will be invalid without any assignment of for empty compound conditions.

Version:
$Revision$ $Date: 2009-07-13 17:22:43 (Mon, 13 Jul 2009) $
Author:
Ahmad Hassan, Ralf Joachim

Constructor Summary
Update(java.lang.String name)
          Construct a SQL update statement that updates records of the table provided.
 
Method Summary
 void addAssignment(Assignment assignment)
          Appends given assignment to the list of Assignment objects.
 void addAssignment(Column column, Expression value)
          Appends an assignment of the given value to the given column.
 Condition getCondition()
          Get condition that specifies which records to update.
 void setCondition(Condition condition)
          Set condition that specifies which records to update.
 void toString(QueryContext ctx)
          Append a string representation of the object to the given QueryContext.
 
Methods inherited from class org.castor.cpa.persistence.sql.query.QueryObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Update

public Update(java.lang.String name)
Construct a SQL update statement that updates records of the table provided.

Parameters:
name - Name of the table in update statement.
Method Detail

addAssignment

public void addAssignment(Assignment assignment)
Appends given assignment to the list of Assignment objects.

Parameters:
assignment - Assignment object added to the list of assignments that will be appended to SET clause of sql statement.

addAssignment

public void addAssignment(Column column,
                          Expression value)
Appends an assignment of the given value to the given column.

Parameters:
column - Column to assign the value to.
value - Expression to be assigned to the column.

getCondition

public Condition getCondition()
Get condition that specifies which records to update.

Returns:
Condition that specifies which records to update.

setCondition

public void setCondition(Condition condition)
Set condition that specifies which records to update.

Parameters:
condition - Condition that specifies which records to update.

toString

public void toString(QueryContext ctx)
Description copied from class: QueryObject
Append a string representation of the object to the given QueryContext. In general, this toString method appends a string that "textually represents" this object. The result should be a string in valid SQL syntax. It is required that all subclasses override this method.

Specified by:
toString in class QueryObject
Parameters:
ctx - QueryContext to append the string representation of the object to.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com