util.sql
Class SQLTransaction
java.lang.Object
|
+--util.sql.SQLTransaction
- public class SQLTransaction
- extends java.lang.Object
A SQL transaction. Uses a SQL Processor to execute queries and updates as part of the
same transaction.
- Since:
- 12/03/2001
- Version:
- 1.0
- Author:
- Ryan Daigle
Method Summary |
void |
commitTransaction()
Commit all queries and updates that are a part of this transaction. |
java.lang.Object[] |
executeQuery(java.lang.String sql,
java.lang.Object[] pStmntValues,
ResultProcessor processor)
Execute a query as part of this transaction. |
void |
executeUpdate(java.lang.String sql,
java.lang.Object[] pStmntValues,
UpdateProcessor processor)
Execute an update as part of this transaction. |
void |
startTransaction()
Start a transaction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SQLTransaction
public SQLTransaction(SQLProcessor sqlProcessor)
- Default constructor. Initializes a new connection for this transaction only.
- Parameters:
appId
- the app id that will determine this transaction's connection permissionsprocessor
-
startTransaction
public void startTransaction()
- Start a transaction. This is automatically called on instantiation, so it only needs to be
called after a transaction has been committed and a new one needs to start. It
initializes the member connection only if it's
null
.
executeQuery
public java.lang.Object[] executeQuery(java.lang.String sql,
java.lang.Object[] pStmntValues,
ResultProcessor processor)
- Execute a query as part of this transaction. If any exception occurs as part
of this execution, then rollback all queries/updates up to this point
and rethrow the Database exception.
- Parameters:
sql
- the sql statement to executepStmntValues
- the values to fill the prepared statement with, can be null
if there are no
values to fillprocessor
- the processor that will handle the result set- Returns:
- the objects returned from the result processor
executeUpdate
public void executeUpdate(java.lang.String sql,
java.lang.Object[] pStmntValues,
UpdateProcessor processor)
- Execute an update as part of this transaction. If any exception occurs as part
of this execution, then rollback all queries/updates up to this point and
rethrow the Database exception.
- Parameters:
sql
- the sql statement to executepStmntValues
- the values to fill the prepared statement with, can be null
if there are no
values to fillprocessor
-
commitTransaction
public void commitTransaction()
- Commit all queries and updates that are a part of this transaction. If any thing fails in
this step, then rollback the transaction.