|
Enterprise Information Portal APIs |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.gcs.db.util.Transaction
A Transaction represents a set of SQL statements to be executed as a unit. These sets of SQL statements may be commited or rolled back through a Transaction object. All SQL statements must be executed and results returned through methods in the Transaction object.
A Transaction object may be constructed by specifying the level of transaction isolation. If no level is specified, the Transaction defaults to TRANSACTION_READ_UNCOMMITTED. When a SQL statement is executed, the Transaction object obtains a java.sql.Connection from the ConnectionManager to execute the statement. It holds onto and uses this connection to execute all subsequent SQL statements and releases it (for use by other threads) only after the Transaction is committed or aborted.
Note: If a transaction is never committed or aborted, the application will go into deadlock.
Field Summary | |
static boolean |
debug
If true, prints all SQL statements to System.out. |
Constructor Summary | |
Transaction()
Default Constructor. |
|
Transaction(int isolationLevel)
Constructor. |
Method Summary | |
void |
abort()
Aborts a transaction in progress. |
void |
commit()
Commits all changes in the transaction and releases the connection. |
java.util.Hashtable |
executeQuery(java.lang.String sql)
Executes a select sql statement which returns at most 1 row as a result. |
java.util.Enumeration |
executeQuery(java.lang.String sql,
int max)
Executes a select sql statement which returns the values from a single column for each row which satisfy the query. |
java.util.Enumeration |
executeQueryT(java.lang.String sql,
int max)
Executes a select sql statement which returns the values for each row which satisfy the query as hashtables which map as (column-name,value) pairs. |
int |
executeUpdate(java.lang.String sql)
Executes an update, insert, or delete sql statement. |
java.io.InputStream |
getBinaryStream(java.lang.String sql)
Executes a select sql statement which returns at most 1 value of type BLOB as a result. |
java.sql.Connection |
getConnection()
Returns a pointer to the connection object in use by this transaction. |
int |
getMaxSqlBytes()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean debug
Constructor Detail |
public Transaction()
public Transaction(int isolationLevel)
isolationLevel
- The transaction isolation level as
defined in java.sql.ConnectionConnection
Method Detail |
public int executeUpdate(java.lang.String sql) throws TransactionException
sql
- The SQL String to execute.TransactionException
- database error
occured during SQL update.public java.util.Hashtable executeQuery(java.lang.String sql) throws TransactionException
sql
- The SQL statement to execute.TransactionException
- SQL error occured during
query execution. Transaction aborted.public java.util.Enumeration executeQuery(java.lang.String sql, int max) throws TransactionException
sql
- The SQL statement to execute.max
- The maximum number of rows to select for. 0
means no maximum.TransactionException
- SQL error occured during
query execution. Transaction aborted.public java.util.Enumeration executeQueryT(java.lang.String sql, int max) throws TransactionException
sql
- The SQL statement to execute.int
- max The maximum number of rows to select for. 0
means no maximum.TransactionException
- SQL error occured during
query execution. Transaction aborted.public java.io.InputStream getBinaryStream(java.lang.String sql) throws TransactionException
sql
- The SQL statement to execute.TransactionException
- SQL error occured during
query execution. Transaction aborted.public void abort()
ImplementationException
- no changes to abort.public void commit() throws TransactionException
TransactionException
- Changes could not be
committed.ImplementationException
- No transaction
in progress.public java.sql.Connection getConnection()
public int getMaxSqlBytes()
|
EIP Web Crawler APIs | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |