net.sourceforge.jtds.jdbcx.proxy

Class ConnectionProxy

Implemented Interfaces:
Connection

public class ConnectionProxy
extends java.lang.Object
implements Connection

This class would be better implemented as a java.lang.reflect.Proxy. However, this feature was not added until 1.3 and reflection performance was not improved until 1.4. Since the driver still needs to be compatible with 1.2 and 1.3 this class is used to delegate the calls to the connection with minimal overhead.
Version:
$Id: ConnectionProxy.java,v 1.7 2005/04/20 16:49:30 alin_sinpalean Exp $

Field Summary

private boolean
_closed
private ConnectionJDBC2
_connection
private PooledConnection
_pooledConnection

Constructor Summary

ConnectionProxy(PooledConnection pooledConnection, Connection connection)
Constructs a new connection proxy.

Method Summary

void
clearWarnings()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
close()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
commit()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
Statement
createStatement()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
Statement
createStatement(int resultSetType, int resultSetConcurrency)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
Statement
createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
protected void
finalize()
Closes the proxy, releasing the connection.
boolean
getAutoCommit()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
String
getCatalog()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
int
getHoldability()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
DatabaseMetaData
getMetaData()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
int
getTransactionIsolation()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
Map
getTypeMap()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
SQLWarning
getWarnings()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
boolean
isClosed()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
boolean
isReadOnly()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
String
nativeSQL(String sql)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
CallableStatement
prepareCall(String sql)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
CallableStatement
prepareCall(String sql, int resultSetType, int resultSetConcurrency)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
CallableStatement
prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
PreparedStatement
prepareStatement(String sql)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
PreparedStatement
prepareStatement(String sql, String[] columnNames)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
PreparedStatement
prepareStatement(String sql, int autoGeneratedKeys)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
PreparedStatement
prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
PreparedStatement
prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
PreparedStatement
prepareStatement(String sql, int[] columnIndexes)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
(package private) void
processSQLException(SQLException sqlException)
Processes SQLExceptions.
void
releaseSavepoint(Savepoint savepoint)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
rollback()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
rollback(Savepoint savepoint)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
setAutoCommit(boolean autoCommit)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
setCatalog(String catalog)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
setHoldability(int holdability)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
setReadOnly(boolean readOnly)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
Savepoint
setSavepoint()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
Savepoint
setSavepoint(String name)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
setTransactionIsolation(int level)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
void
setTypeMap(Map map)
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.
private void
validateConnection()
Validates the connection state.

Field Details

_closed

private boolean _closed

_connection

private ConnectionJDBC2 _connection

_pooledConnection

private PooledConnection _pooledConnection

Constructor Details

ConnectionProxy

public ConnectionProxy(PooledConnection pooledConnection,
                       Connection connection)
Constructs a new connection proxy.

Method Details

clearWarnings

public void clearWarnings()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

close

public void close()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

commit

public void commit()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

createStatement

public Statement createStatement()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency,
                                 int resultSetHoldability)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

finalize

protected void finalize()
Closes the proxy, releasing the connection.

getAutoCommit

public boolean getAutoCommit()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

getCatalog

public String getCatalog()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

getHoldability

public int getHoldability()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

getMetaData

public DatabaseMetaData getMetaData()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

getTransactionIsolation

public int getTransactionIsolation()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

getTypeMap

public Map getTypeMap()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

getWarnings

public SQLWarning getWarnings()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

isClosed

public boolean isClosed()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

isReadOnly

public boolean isReadOnly()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

nativeSQL

public String nativeSQL(String sql)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareCall

public CallableStatement prepareCall(String sql)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency,
                                     int resultSetHoldability)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareStatement

public PreparedStatement prepareStatement(String sql)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          String[] columnNames)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int autoGeneratedKeys)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int[] columnIndexes)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

processSQLException

(package private)  void processSQLException(SQLException sqlException)
            throws SQLException
Processes SQLExceptions.

releaseSavepoint

public void releaseSavepoint(Savepoint savepoint)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

rollback

public void rollback()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

rollback

public void rollback(Savepoint savepoint)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

setAutoCommit

public void setAutoCommit(boolean autoCommit)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

setCatalog

public void setCatalog(String catalog)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

setHoldability

public void setHoldability(int holdability)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

setReadOnly

public void setReadOnly(boolean readOnly)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

setSavepoint

public Savepoint setSavepoint()
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

setSavepoint

public Savepoint setSavepoint(String name)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

setTransactionIsolation

public void setTransactionIsolation(int level)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

setTypeMap

public void setTypeMap(Map map)
            throws SQLException
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.

validateConnection

private void validateConnection()
            throws SQLException
Validates the connection state.

Generated on June 12 2008