Class StatementProxy

java.lang.Object
net.sourceforge.jtds.jdbcx.proxy.StatementProxy
All Implemented Interfaces:
AutoCloseable, Statement, Wrapper
Direct Known Subclasses:
PreparedStatementProxy

public class StatementProxy extends Object implements 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
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    void
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    void
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    void
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    void
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    void
     
    boolean
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    boolean
    execute(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(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(String sql, 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[]
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    executeUpdate(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(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(String sql, String[] columnNames)
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    boolean
    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
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    int
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    Delgates calls to the statement; SQLExceptions thrown from the statement will cause an event to be fired on the connection pool listeners.
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    protected void
    Processes SQLExceptions.
    void
    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.
    unwrap(Class arg0)
     
    protected void
    Validates the connection state.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • executeQuery

      public ResultSet executeQuery(String sql) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • executeUpdate

      public int executeUpdate(String sql) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • close

      public void close() throws 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 AutoCloseable
      Specified by:
      close in interface Statement
      Throws:
      SQLException - if an error occurs
    • getMaxFieldSize

      public int getMaxFieldSize() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • setMaxFieldSize

      public void setMaxFieldSize(int max) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getMaxRows

      public int getMaxRows() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • setMaxRows

      public void setMaxRows(int max) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • setEscapeProcessing

      public void setEscapeProcessing(boolean enable) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getQueryTimeout

      public int getQueryTimeout() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • setQueryTimeout

      public void setQueryTimeout(int seconds) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • cancel

      public void cancel() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getWarnings

      public SQLWarning getWarnings() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • clearWarnings

      public void clearWarnings() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • setCursorName

      public void setCursorName(String name) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • execute

      public boolean execute(String sql) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getResultSet

      public ResultSet getResultSet() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getUpdateCount

      public int getUpdateCount() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getMoreResults

      public boolean getMoreResults() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • setFetchDirection

      public void setFetchDirection(int direction) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getFetchDirection

      public int getFetchDirection() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • setFetchSize

      public void setFetchSize(int rows) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getFetchSize

      public int getFetchSize() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getResultSetConcurrency

      public int getResultSetConcurrency() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getResultSetType

      public int getResultSetType() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • addBatch

      public void addBatch(String sql) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • clearBatch

      public void clearBatch() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • executeBatch

      public int[] executeBatch() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getConnection

      public Connection getConnection() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getMoreResults

      public boolean getMoreResults(int current) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getGeneratedKeys

      public ResultSet getGeneratedKeys() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • executeUpdate

      public int executeUpdate(String sql, int autoGeneratedKeys) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • executeUpdate

      public int executeUpdate(String sql, int[] columnIndexes) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • executeUpdate

      public int executeUpdate(String sql, String[] columnNames) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • execute

      public boolean execute(String sql, int autoGeneratedKeys) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • execute

      public boolean execute(String sql, int[] columnIndexes) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • execute

      public boolean execute(String sql, String[] columnNames) throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • getResultSetHoldability

      public int getResultSetHoldability() throws 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 Statement
      Throws:
      SQLException - if an error occurs
    • validateConnection

      protected void validateConnection() throws SQLException
      Validates the connection state.
      Throws:
      SQLException
    • processSQLException

      protected void processSQLException(SQLException sqlException) throws SQLException
      Processes SQLExceptions.
      Throws:
      SQLException
    • isClosed

      public boolean isClosed() throws SQLException
      Specified by:
      isClosed in interface Statement
      Throws:
      SQLException
    • isPoolable

      public boolean isPoolable() throws SQLException
      Specified by:
      isPoolable in interface Statement
      Throws:
      SQLException
    • setPoolable

      public void setPoolable(boolean poolable) throws SQLException
      Specified by:
      setPoolable in interface Statement
      Throws:
      SQLException
    • isWrapperFor

      public boolean isWrapperFor(Class arg0) throws SQLException
      Specified by:
      isWrapperFor in interface Wrapper
      Throws:
      SQLException
    • unwrap

      public Object unwrap(Class arg0) throws SQLException
      Specified by:
      unwrap in interface Wrapper
      Throws:
      SQLException
    • closeOnCompletion

      public void closeOnCompletion() throws SQLException
      Specified by:
      closeOnCompletion in interface Statement
      Throws:
      SQLException
    • isCloseOnCompletion

      public boolean isCloseOnCompletion() throws SQLException
      Specified by:
      isCloseOnCompletion in interface Statement
      Throws:
      SQLException