Package net.sourceforge.jtds.jdbcx.proxy
Class StatementProxy
- java.lang.Object
-
- net.sourceforge.jtds.jdbcx.proxy.StatementProxy
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.Statement,java.sql.Wrapper
- Direct Known Subclasses:
PreparedStatementProxy
public class StatementProxy extends java.lang.Object implements java.sql.StatementThis 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 a statement with minimal overhead.- Version:
- $Id: StatementProxy.java,v 1.4.4.3 2009-12-30 08:45:34 ickzon Exp $
-
-
Field Summary
Fields Modifier and Type Field Description private ConnectionProxy_connectionprivate JtdsStatement_statement
-
Constructor Summary
Constructors Constructor Description StatementProxy(ConnectionProxy connection, JtdsStatement statement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBatch(java.lang.String sql)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidcancel()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidclearBatch()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidclearWarnings()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidclose()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidcloseOnCompletion()booleanexecute(java.lang.String sql)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.booleanexecute(java.lang.String sql, int autoGeneratedKeys)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.booleanexecute(java.lang.String sql, int[] columnIndexes)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.booleanexecute(java.lang.String sql, java.lang.String[] columnNames)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int[]executeBatch()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.sql.ResultSetexecuteQuery(java.lang.String sql)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intexecuteUpdate(java.lang.String sql)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intexecuteUpdate(java.lang.String sql, int autoGeneratedKeys)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intexecuteUpdate(java.lang.String sql, int[] columnIndexes)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intexecuteUpdate(java.lang.String sql, java.lang.String[] columnNames)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.sql.ConnectiongetConnection()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetFetchDirection()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetFetchSize()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.sql.ResultSetgetGeneratedKeys()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetMaxFieldSize()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetMaxRows()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.booleangetMoreResults()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.booleangetMoreResults(int current)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetQueryTimeout()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.sql.ResultSetgetResultSet()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetResultSetConcurrency()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetResultSetHoldability()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetResultSetType()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.intgetUpdateCount()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.sql.SQLWarninggetWarnings()Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.booleanisClosed()booleanisCloseOnCompletion()booleanisPoolable()booleanisWrapperFor(java.lang.Class arg0)protected voidprocessSQLException(java.sql.SQLException sqlException)Processes SQLExceptions.voidsetCursorName(java.lang.String name)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidsetEscapeProcessing(boolean enable)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidsetFetchDirection(int direction)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidsetFetchSize(int rows)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidsetMaxFieldSize(int max)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidsetMaxRows(int max)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.voidsetPoolable(boolean poolable)voidsetQueryTimeout(int seconds)Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.lang.Objectunwrap(java.lang.Class arg0)protected voidvalidateConnection()Validates the connection state.
-
-
-
Field Detail
-
_connection
private ConnectionProxy _connection
-
_statement
private JtdsStatement _statement
-
-
Constructor Detail
-
StatementProxy
StatementProxy(ConnectionProxy connection, JtdsStatement statement)
-
-
Method Detail
-
executeQuery
public java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeQueryin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
close
public void close() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getMaxFieldSize
public int getMaxFieldSize() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getMaxFieldSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setMaxFieldSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getMaxRows
public int getMaxRows() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getMaxRowsin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
setMaxRows
public void setMaxRows(int max) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setMaxRowsin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setEscapeProcessingin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getQueryTimeout
public int getQueryTimeout() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getQueryTimeoutin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setQueryTimeoutin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
cancel
public void cancel() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
cancelin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getWarningsin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
clearWarnings
public void clearWarnings() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
clearWarningsin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
setCursorName
public void setCursorName(java.lang.String name) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setCursorNamein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
execute
public boolean execute(java.lang.String sql) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getResultSetin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getUpdateCount
public int getUpdateCount() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getUpdateCountin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getMoreResults
public boolean getMoreResults() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getMoreResultsin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
setFetchDirection
public void setFetchDirection(int direction) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setFetchDirectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getFetchDirection
public int getFetchDirection() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getFetchDirectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
setFetchSize
public void setFetchSize(int rows) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setFetchSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getFetchSize
public int getFetchSize() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getFetchSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getResultSetConcurrency
public int getResultSetConcurrency() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getResultSetConcurrencyin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getResultSetType
public int getResultSetType() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getResultSetTypein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
addBatch
public void addBatch(java.lang.String sql) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
addBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
clearBatch
public void clearBatch() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
clearBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
executeBatch
public int[] executeBatch() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getConnectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getMoreResults
public boolean getMoreResults(int current) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getMoreResultsin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getGeneratedKeys
public java.sql.ResultSet getGeneratedKeys() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getGeneratedKeysin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
executeUpdate
public int executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
executeUpdate
public int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
executeUpdate
public int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
execute
public boolean execute(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
execute
public boolean execute(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
execute
public boolean execute(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
getResultSetHoldability
public int getResultSetHoldability() throws java.sql.SQLExceptionDelgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getResultSetHoldabilityin interfacejava.sql.Statement- Throws:
java.sql.SQLException- if an error occurs
-
validateConnection
protected void validateConnection() throws java.sql.SQLExceptionValidates the connection state.- Throws:
java.sql.SQLException
-
processSQLException
protected void processSQLException(java.sql.SQLException sqlException) throws java.sql.SQLExceptionProcesses SQLExceptions.- Throws:
java.sql.SQLException
-
isClosed
public boolean isClosed() throws java.sql.SQLException- Specified by:
isClosedin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
isPoolable
public boolean isPoolable() throws java.sql.SQLException- Specified by:
isPoolablein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setPoolable
public void setPoolable(boolean poolable) throws java.sql.SQLException- Specified by:
setPoolablein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class arg0) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
unwrap
public java.lang.Object unwrap(java.lang.Class arg0) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
closeOnCompletion
public void closeOnCompletion() throws java.sql.SQLException- Specified by:
closeOnCompletionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
isCloseOnCompletion
public boolean isCloseOnCompletion() throws java.sql.SQLException- Specified by:
isCloseOnCompletionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
-