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.Statement
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 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
_connection
private 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 void
addBatch(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.void
cancel()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
clearBatch()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
clearWarnings()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
close()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
closeOnCompletion()
boolean
execute(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.boolean
execute(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.boolean
execute(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.boolean
execute(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.ResultSet
executeQuery(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.int
executeUpdate(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.int
executeUpdate(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.int
executeUpdate(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.int
executeUpdate(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.Connection
getConnection()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getFetchDirection()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getFetchSize()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.sql.ResultSet
getGeneratedKeys()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getMaxFieldSize()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getMaxRows()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.boolean
getMoreResults()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.boolean
getMoreResults(int current)
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getQueryTimeout()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.sql.ResultSet
getResultSet()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getResultSetConcurrency()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getResultSetHoldability()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getResultSetType()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.int
getUpdateCount()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.java.sql.SQLWarning
getWarnings()
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.boolean
isClosed()
boolean
isCloseOnCompletion()
boolean
isPoolable()
boolean
isWrapperFor(java.lang.Class arg0)
protected void
processSQLException(java.sql.SQLException sqlException)
Processes SQLExceptions.void
setCursorName(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.void
setEscapeProcessing(boolean enable)
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
setFetchDirection(int direction)
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
setFetchSize(int rows)
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
setMaxFieldSize(int max)
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
setMaxRows(int max)
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.void
setPoolable(boolean poolable)
void
setQueryTimeout(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.Object
unwrap(java.lang.Class arg0)
protected void
validateConnection()
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.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeQuery
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
close
public void close() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getMaxFieldSize
public int getMaxFieldSize() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getMaxFieldSize
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setMaxFieldSize
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getMaxRows
public int getMaxRows() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getMaxRows
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
setMaxRows
public void setMaxRows(int max) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setMaxRows
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setEscapeProcessing
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getQueryTimeout
public int getQueryTimeout() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getQueryTimeout
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setQueryTimeout
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
cancel
public void cancel() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
cancel
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getWarnings
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
clearWarnings
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
setCursorName
public void setCursorName(java.lang.String name) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setCursorName
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
execute
public boolean execute(java.lang.String sql) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
execute
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getResultSet
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getUpdateCount
public int getUpdateCount() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getUpdateCount
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getMoreResults
public boolean getMoreResults() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getMoreResults
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
setFetchDirection
public void setFetchDirection(int direction) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setFetchDirection
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getFetchDirection
public int getFetchDirection() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getFetchDirection
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
setFetchSize
public void setFetchSize(int rows) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
setFetchSize
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getFetchSize
public int getFetchSize() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getFetchSize
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getResultSetConcurrency
public int getResultSetConcurrency() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getResultSetConcurrency
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getResultSetType
public int getResultSetType() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getResultSetType
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
addBatch
public void addBatch(java.lang.String sql) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
addBatch
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
clearBatch
public void clearBatch() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
clearBatch
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
executeBatch
public int[] executeBatch() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeBatch
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getConnection
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getMoreResults
public boolean getMoreResults(int current) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getMoreResults
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getGeneratedKeys
public java.sql.ResultSet getGeneratedKeys() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getGeneratedKeys
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
executeUpdate
public int executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
executeUpdate
public int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeUpdate
in 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.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
execute
public boolean execute(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
execute
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
execute
public boolean execute(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
execute
in 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.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
execute
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
getResultSetHoldability
public int getResultSetHoldability() throws java.sql.SQLException
Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.- Specified by:
getResultSetHoldability
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
- if an error occurs
-
validateConnection
protected void validateConnection() throws java.sql.SQLException
Validates the connection state.- Throws:
java.sql.SQLException
-
processSQLException
protected void processSQLException(java.sql.SQLException sqlException) throws java.sql.SQLException
Processes SQLExceptions.- Throws:
java.sql.SQLException
-
isClosed
public boolean isClosed() throws java.sql.SQLException
- Specified by:
isClosed
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
isPoolable
public boolean isPoolable() throws java.sql.SQLException
- Specified by:
isPoolable
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setPoolable
public void setPoolable(boolean poolable) throws java.sql.SQLException
- Specified by:
setPoolable
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class arg0) throws java.sql.SQLException
- Specified by:
isWrapperFor
in interfacejava.sql.Wrapper
- Throws:
java.sql.SQLException
-
unwrap
public java.lang.Object unwrap(java.lang.Class arg0) throws java.sql.SQLException
- Specified by:
unwrap
in interfacejava.sql.Wrapper
- Throws:
java.sql.SQLException
-
closeOnCompletion
public void closeOnCompletion() throws java.sql.SQLException
- Specified by:
closeOnCompletion
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
isCloseOnCompletion
public boolean isCloseOnCompletion() throws java.sql.SQLException
- Specified by:
isCloseOnCompletion
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
-