net.sourceforge.jtds.jdbcx.proxy
Class StatementProxy

java.lang.Object
  extended bynet.sourceforge.jtds.jdbcx.proxy.StatementProxy
All Implemented Interfaces:
java.sql.Statement
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
private  ConnectionProxy _connection
           
private  JtdsStatement _statement
           
 
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Constructor Summary
(package private) StatementProxy(ConnectionProxy connection, JtdsStatement statement)
           
 
Method Summary
 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.
 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.
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 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.
protected  void validateConnection()
          Validates the connection state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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 interface java.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


Generated on October 27 2012