Package net.sourceforge.jtds.jdbcx.proxy
Class ConnectionProxy
java.lang.Object
net.sourceforge.jtds.jdbcx.proxy.ConnectionProxy
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
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.2.3 2009-12-30 08:45:34 ickzon Exp $
-
Field Summary
FieldsFields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
ConstructorsConstructorDescriptionConnectionProxy
(PooledConnection pooledConnection, Connection connection) Constructs a new connection proxy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
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.createArrayOf
(String typeName, Object[] elements) Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.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.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.createStruct
(String typeName, Object[] attributes) protected void
finalize()
Closes the proxy, releasing the connection.boolean
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.getClientInfo
(String name) int
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.int
int
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.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
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.boolean
isValid
(int timeout) boolean
isWrapperFor
(Class arg0) Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.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.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.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.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.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.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.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.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.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.(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
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
setClientInfo
(String name, String value) void
setClientInfo
(Properties properties) 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
setNetworkTimeout
(Executor executor, int milliseconds) 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.Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.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
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
Validates the connection state.Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Field Details
-
_pooledConnection
-
_connection
-
_closed
private boolean _closed
-
-
Constructor Details
-
ConnectionProxy
Constructs a new connection proxy.
-
-
Method Details
-
clearWarnings
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
clearWarnings
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
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.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
-
commit
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
commit
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
createStatement
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
createStatement
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
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.- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
getAutoCommit
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getAutoCommit
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
getCatalog
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getCatalog
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
getHoldability
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getHoldability
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
getTransactionIsolation
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getTransactionIsolation
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
getTypeMap
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getTypeMap
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
getWarnings
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getWarnings
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
getMetaData
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getMetaData
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
isClosed
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
isClosed
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
isReadOnly
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
isReadOnly
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
nativeSQL
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
nativeSQL
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
prepareCall
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
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.- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
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.- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
prepareStatement
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
prepareStatement
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
prepareStatement
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
prepareStatement
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
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.- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
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.- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
releaseSavepoint
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
releaseSavepoint
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
rollback
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
rollback
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
setAutoCommit
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setAutoCommit
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
setCatalog
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setCatalog
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
setHoldability
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setHoldability
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
setReadOnly
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setReadOnly
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
setSavepoint
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
setSavepoint
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
setTransactionIsolation
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setTransactionIsolation
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
setTypeMap
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setTypeMap
in interfaceConnection
- Throws:
SQLException
- if an error occurs
-
validateConnection
Validates the connection state.- Throws:
SQLException
-
processSQLException
Processes SQLExceptions.- Throws:
SQLException
-
finalize
protected void finalize()Closes the proxy, releasing the connection. -
createArrayOf
- Specified by:
createArrayOf
in interfaceConnection
- Throws:
SQLException
-
createBlob
- Specified by:
createBlob
in interfaceConnection
- Throws:
SQLException
-
createClob
- Specified by:
createClob
in interfaceConnection
- Throws:
SQLException
-
createNClob
- Specified by:
createNClob
in interfaceConnection
- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXML
in interfaceConnection
- Throws:
SQLException
-
createStruct
- Specified by:
createStruct
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
isValid
- Specified by:
isValid
in interfaceConnection
- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
setSchema
- Specified by:
setSchema
in interfaceConnection
- Throws:
SQLException
-
getSchema
- Specified by:
getSchema
in interfaceConnection
- Throws:
SQLException
-
abort
- Specified by:
abort
in interfaceConnection
- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-