|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.jdc.lang.Object
|
+--com.jdc.rdb.sql.SQL
|
+--com.jdc.rdb.sql.dml.DML
|
+--com.jdc.rdb.sql.dml.update.Update
Update represents a Data Manipulation Language Update
SQL statement. The Update statement updates
the values of specified columns in rows of a Table table or
View. Updating a row of a View updates a row of its
base Table.
UPDATE form is used to update one or more rows
(optionally determined by a search condition).UPDATE form is used to update exactly one row
(as determined by the current position of a cursor).Update by a search condition is supported.
SQL statements. It is an executable statement
that can be dynamically prepared.UPDATE privilege on the table or view where rows are to be updated.UPDATE privilege on each of the columns to be updated.CONTROL privilege on the table or view where rows are to be updated.SYSADM or DBADM authority.Update statement, the privileges
held by the authorization ID of the statement must also include at least one of the
following for each table or view referenced by a subquery
(for IBM® DB2 Universal Database™):
SELECT privilege.CONTROL privilege.SYSADM or DBADM authority.
Update update = new Update(table);
update.setWhere(column 1 , 123 );
update.setWhere(column 2 , "Key" );
. . .
update.setValue(column 3 , true ); // boolean Column
update.setValue(column 4 , 456 ); // int Column
update.setValue(column 5 , "String" ); // String Column
update.setValue(column 6 , new Date()); // Date Column
. . .
UpdateStatus status = update.execute();
if (status.isSuccessful())
{
// Update success
}
else
{
// Update failed!
}Update of a View is not currently supported.
Target,
Correlation,
Set,
Where,
With,
Serialized Form| Field Summary | |
static String |
COMMAND
The Update statement command keyword. |
| Fields inherited from class com.jdc.rdb.sql.dml.DML |
sql |
| Fields inherited from class com.jdc.lang.Object |
string |
| Constructor Summary | |
Update()
Constructs a new Update statement object. |
|
Update(String statement)
Constructs a new Update statement object for the specified
Update statement. |
|
Update(Table table)
Constructs a new Update statement object for the specified
Database Table. |
|
| Method Summary | |
UpdateStatus |
execute()
Executes the Update statement and returns
an UpdateStatus object. |
Set |
getSet()
Returns the Set clause for this Update statement. |
Target |
getTarget()
Returns the com.jdc.rdb.sql.dml.Target clause for this Update
statement. |
Where |
getWhere()
Returns the Where clause for this Update statement. |
protected boolean |
isValid()
Returns true if the Update statement is valid. |
Update |
set(UpdateClause clause)
Sets an UpdateClause for this Update
statement. |
Update |
setValue(Column column,
boolean value)
Sets a boolean value for the specified Column. |
Update |
setValue(Column column,
int value)
Sets an int value for the specified Column. |
Update |
setValue(Column column,
Object value)
Sets an Object value for the specified Column. |
Update |
setWhere(Column column,
int value)
Sets a search condition for the specified table Column
and int value. |
Update |
setWhere(Column column,
Object value)
Sets a search condition for the specified table Column
and Object value. |
| Methods inherited from class com.jdc.rdb.sql.dml.DML |
finalize, getColumn, getConnection, getTable, setTable |
| Methods inherited from class com.jdc.rdb.sql.SQL |
addClause, execute, getClause, getCommand, getStatement, setCommand, setConnection, setStatement, toString |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String COMMAND
Update statement command keyword.
| Constructor Detail |
public Update()
Update statement object.
public Update(Table table)
Update statement object for the specified
Database Table.
SQLInvalidException - No table definition is specified.public Update(String statement)
Update statement object for the specified
Update statement.
SQLInvalidException - No DELETE statement is specified.| Method Detail |
public UpdateStatus execute()
Update statement and returns
an UpdateStatus object.
Update statement status.public Target getTarget()
com.jdc.rdb.sql.dml.Target clause for this Update
statement.
Update statement Target clause.public Set getSet()
Set clause for this Update statement.
Update statement Set clause.public Where getWhere()
Where clause for this Update statement.
Update statement Where clause.protected boolean isValid()
isValid in class SQLTrue if the SQL statement is valid. False if the SQL statement is not validpublic Update set(UpdateClause clause)
UpdateClause for this Update
statement. Use this method to specify a custom Update clause.
Update statement object.
SQLInvalidException - No UPDATE statement clause is specified.
public Update setValue(Column column,
boolean value)
boolean value for the specified Column.
The Column alias is used to create the Columns
clause and the boolean value is used to create the Values
clause for this Update statement.
Update statement object.
SQLInvalidException - No column is specified, an invalid
column is specified, or a column for which a value has
already been set is specified.
public Update setValue(Column column,
int value)
int value for the specified Column.
The Column alias is used to create the Columns
clause and the int value is used to create the Values
clause for this Update statement.
Update statement object.
SQLInvalidException - No column is specified, an invalid
column is specified, or a column for which a value has
already been set is specified.
public Update setValue(Column column,
Object value)
Object value for the specified Column.
The Column alias is used to create the Columns
clause and the Object value is used to create the Values
clause for this Update statement.
Update statement object.
SQLInvalidException - No column is specified, an invalid
column is specified, or a column for which a value has
already been set is specified.
public Update setWhere(Column column,
int value)
Column
and int value. These values are used to create the com.jdc.rdb.sql.dml.Where
clause for this statement. A com.jdc.rdb.sql.dml.Comparison
operator of EQUAL, i.e. "=", is implied.
Update statement object.
SQLInvalidException - No column is specified or an invalid
table column is specified.
public Update setWhere(Column column,
Object value)
Column
and Object value. These values are used to create the com.jdc.rdb.sql.dml.Where
clause for this statement. A com.jdc.rdb.sql.dml.Comparison
operator of EQUAL, i.e. "=", is implied.
Update statement object.
SQLInvalidException - No column is specified or an invalid
table column is specified.
|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||