Enterprise Information Portal APIs

com.ibm.gcs.db.util
Class PreparedTransaction

java.lang.Object
  |
  +--com.ibm.gcs.db.util.Transaction
        |
        +--com.ibm.gcs.db.util.PreparedTransaction

public class PreparedTransaction
extends Transaction

A PreparedTransaction extends the functionality of a Transaction by providing support for java.sql.PreparedStatements.

See Also:
PreparedStatement, Connection

Fields inherited from class com.ibm.gcs.db.util.Transaction
debug
 
Constructor Summary
PreparedTransaction()
          Default Constructor.
PreparedTransaction(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()
          Executes a prepared sql statement which returns at most 1 row as a result.
 int executeUpdate()
          Executes a prepared update, insert, or delete sql statement.
 void prepareStatement(java.lang.String sql)
          Prepares a JDBC prepared statement to be executed.
 void setBinaryStream(int parameterIndex, java.io.InputStream x, int length)
          Send a binary stream value as input to a LONGVARBINARY parameter.
 void setString(int parameterIndex, java.lang.String x)
          Set a string value as the input parameter.
 
Methods inherited from class com.ibm.gcs.db.util.Transaction
executeQuery, executeQuery, executeQueryT, executeUpdate, getBinaryStream, getConnection, getMaxSqlBytes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreparedTransaction

public PreparedTransaction()
Default Constructor.

PreparedTransaction

public PreparedTransaction(int isolationLevel)
Constructor.
Parameters:
isolationLevel - The transacation isolation level as defined in java.sql.Connection
Method Detail

prepareStatement

public void prepareStatement(java.lang.String sql)
                      throws TransactionException
Prepares a JDBC prepared statement to be executed.
Parameters:
sql - the SQL String statement.
Throws:
TransactionException - SQL error occurred during statement creation.
See Also:
PreparedStatement

setBinaryStream

public void setBinaryStream(int parameterIndex,
                            java.io.InputStream x,
                            int length)
                     throws TransactionException
Send a binary stream value as input to a LONGVARBINARY parameter.
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java input stream which contains the binary parameter value.
length - the number of bytes in the stream
Throws:
TransactionException - SQL error occurred while setting parameters.

setString

public void setString(int parameterIndex,
                      java.lang.String x)
               throws TransactionException
Set a string value as the input parameter.
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java String.
Throws:
TransactionException - SQL error occurred while setting parameters.

executeUpdate

public int executeUpdate()
                  throws TransactionException
Executes a prepared update, insert, or delete sql statement. Returns the update count.
Returns:
int-The number of rows updated.
Throws:
TransactionException - database error occured during SQL update.

executeQuery

public java.util.Hashtable executeQuery()
                                 throws TransactionException
Executes a prepared sql statement which returns at most 1 row as a result. Returns the data in a hashtable using column names as keys. If the column has no name, the key is the empty string (eg. for functions like count(*)).
Parameters:
sql - the SQL statement to execute.
Returns:
Hashtable The data returned by the query. Null if no results returned.
Throws:
TransactionException - SQL error occured during query execution. Transaction aborted.

abort

public void abort()
Aborts a transaction in progress. Overides super.
Overrides:
abort in class Transaction
Throws:
ImplementationException - no changes to abort.

commit

public void commit()
            throws TransactionException
Commits all changes in the transaction and releases the connection. If the changes could not be committed, aborts the transaction and throws a TransactionException.
Overrides:
commit in class Transaction
Throws:
TransactionException - Changes could not be committed.
ImplementationException - No transaction in progress.

EIP Web Crawler APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.