org.glite.security.voms.database.connection
Class Transaction

java.lang.Object
  extended byorg.glite.security.voms.database.connection.Transaction
Direct Known Subclasses:
ClientTransaction, DirectUpdate

public abstract class Transaction
extends java.lang.Object

A wrapper around java.sql.Connection for convenient handling of prepared SQL statements.

Author:
Karoly Lorentey

Field Summary
protected  java.sql.Connection conn
          The raw database connection.
protected static org.apache.log4j.Logger log
          Logger.
 
Constructor Summary
protected Transaction(java.sql.Connection conn)
          Protected constructor.
 
Method Summary
 java.sql.Connection getConnection()
          Returns the raw java.sql.Connection object associated with this handler.
 java.sql.PreparedStatement getStatement(java.lang.String statement)
          Converts the given SQL statement to a PreparedStatement.
 int getStatementCount()
          Return the number of times getStatement() was executed in this transaction so far.
 boolean isReadOnly()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log
Logger.


conn

protected java.sql.Connection conn
The raw database connection.

Constructor Detail

Transaction

protected Transaction(java.sql.Connection conn)
Protected constructor.

Method Detail

getConnection

public java.sql.Connection getConnection()
Returns the raw java.sql.Connection object associated with this handler.


getStatement

public java.sql.PreparedStatement getStatement(java.lang.String statement)
                                        throws java.sql.SQLException
Converts the given SQL statement to a PreparedStatement. This is usually equivalent to the prepareStatement method of the wrapped java.sql.Connection object.

Throws:
java.sql.SQLException

isReadOnly

public boolean isReadOnly()

getStatementCount

public final int getStatementCount()
Return the number of times getStatement() was executed in this transaction so far. Useful for a rough performance measurement.