tribble.sql
Class StatementAdapter

java.lang.Object
  extended by tribble.sql.StatementAdapter
All Implemented Interfaces:
java.sql.Statement
Direct Known Subclasses:
FakeStatement

public class StatementAdapter
extends java.lang.Object
implements java.sql.Statement

JDBC statement adapter class. Provides all the methods required by the java.sql.Statement class, most of which do nothing but throw an UnsupportedOperationException. Subclasses that extend this base class can then implement only the methods that they need.

Source code:
Available at: http://david.tribble.com/src/java/tribble/sql/StatementAdapter.java
Documentation:
Available at: http://david.tribble.com/docs/tribble/sql/StatementAdapter.html

Since:
2008-09-04
Version:
@(#)$Revision: 1.2 $ $Date: 2008/09/06 17:49:07 $
Author:
David R. Tribble (david@tribble.com)

Copyright ©2008 by David R. Tribble, all rights reserved.
Permission is granted to any person or entity except those designated by by the United States Department of State as a terrorist, or terrorist government or agency, to use and distribute this source code provided that the original copyright notice remains present and unaltered.

See Also:
ResultSetAdapter

Field Summary
static int CLOSE_ALL_RESULTS
          Constant indicating that all ResultSet objects that have previously been kept open should be closed when calling getMoreResults().
static int CLOSE_CURRENT_RESULT
          Constant indicating that the current ResultSet object should be closed when calling getMoreResults().
static int EXECUTE_FAILED
          Constant indicating that an error occured while executing a batch statement.
static int KEEP_CURRENT_RESULT
          Constant indicating that the current ResultSet object should not be closed when calling getMoreResults().
static int NO_GENERATED_KEYS
          Constant indicating that generated keys should not be made available for retrieval.
static int RETURN_GENERATED_KEYS
          Constant indicating that generated keys should be made available for retrieval.
(package private) static java.lang.String REV
           
static int SUCCESS_NO_INFO
          Constant indicating that a batch statement executed successfully but that no count of the number of rows it affected is available.
 
Constructor Summary
StatementAdapter(java.sql.Connection conn)
          Constructor.
 
Method Summary
 void addBatch(java.lang.String s)
           
 void cancel()
           
 void clearBatch()
           
 void clearWarnings()
           
 void close()
           
 boolean execute(java.lang.String stmt)
           
 boolean execute(java.lang.String stmt, int parm)
           
 boolean execute(java.lang.String stmt, int[] parms)
           
 boolean execute(java.lang.String stmt, java.lang.String[] parms)
           
 int[] executeBatch()
           
 java.sql.ResultSet executeQuery(java.lang.String stmt)
           
 int executeUpdate(java.lang.String stmt)
           
 int executeUpdate(java.lang.String stmt, int parm)
           
 int executeUpdate(java.lang.String stmt, int[] parms)
           
 int executeUpdate(java.lang.String stmt, java.lang.String[] parms)
           
 java.sql.Connection getConnection()
           
 int getFetchDirection()
           
 int getFetchSize()
           
 java.sql.ResultSet getGeneratedKeys()
           
 int getMaxFieldSize()
           
 int getMaxRows()
           
 boolean getMoreResults()
           
 boolean getMoreResults(int n)
           
 int getQueryTimeout()
           
 java.sql.ResultSet getResultSet()
           
 int getResultSetConcurrency()
           
 int getResultSetHoldability()
           
 int getResultSetType()
           
 int getUpdateCount()
           
 java.sql.SQLWarning getWarnings()
           
 void setCursorName(java.lang.String s)
           
 void setEscapeProcessing(boolean f)
           
 void setFetchDirection(int n)
           
 void setFetchSize(int n)
           
 void setMaxFieldSize(int n)
           
 void setMaxRows(int n)
           
 void setQueryTimeout(int n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REV

static final java.lang.String REV
See Also:
Constant Field Values

CLOSE_ALL_RESULTS

public static final int CLOSE_ALL_RESULTS
Constant indicating that all ResultSet objects that have previously been kept open should be closed when calling getMoreResults().

See Also:
Constant Field Values

CLOSE_CURRENT_RESULT

public static final int CLOSE_CURRENT_RESULT
Constant indicating that the current ResultSet object should be closed when calling getMoreResults().

See Also:
Constant Field Values

KEEP_CURRENT_RESULT

public static final int KEEP_CURRENT_RESULT
Constant indicating that the current ResultSet object should not be closed when calling getMoreResults().

See Also:
Constant Field Values

EXECUTE_FAILED

public static final int EXECUTE_FAILED
Constant indicating that an error occured while executing a batch statement.

See Also:
Constant Field Values

NO_GENERATED_KEYS

public static final int NO_GENERATED_KEYS
Constant indicating that generated keys should not be made available for retrieval.

See Also:
Constant Field Values

RETURN_GENERATED_KEYS

public static final int RETURN_GENERATED_KEYS
Constant indicating that generated keys should be made available for retrieval.

See Also:
Constant Field Values

SUCCESS_NO_INFO

public static final int SUCCESS_NO_INFO
Constant indicating that a batch statement executed successfully but that no count of the number of rows it affected is available.

See Also:
Constant Field Values
Constructor Detail

StatementAdapter

public StatementAdapter(java.sql.Connection conn)
Constructor.

Since:
1.1, 2008-09-02
Method Detail

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface java.sql.Statement
Throws:
java.sql.SQLException

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String stmt)
                                throws java.sql.SQLException
Specified by:
executeQuery in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String stmt)
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String stmt,
                       java.lang.String[] parms)
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String stmt,
                       int parm)
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

execute

public boolean execute(java.lang.String stmt,
                       int[] parms)
                throws java.sql.SQLException
Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String stmt)
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String stmt,
                         java.lang.String[] parms)
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String stmt,
                         int parm)
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate(java.lang.String stmt,
                         int[] parms)
                  throws java.sql.SQLException
Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException
Specified by:
executeBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSet

public java.sql.ResultSet getResultSet()
                                throws java.sql.SQLException
Specified by:
getResultSet in interface java.sql.Statement
Throws:
java.sql.SQLException

getMoreResults

public boolean getMoreResults()
                       throws java.sql.SQLException
Specified by:
getMoreResults in interface java.sql.Statement
Throws:
java.sql.SQLException

getMoreResults

public boolean getMoreResults(int n)
                       throws java.sql.SQLException
Specified by:
getMoreResults in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetType

public int getResultSetType()
                     throws java.sql.SQLException
Specified by:
getResultSetType in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetHoldability

public int getResultSetHoldability()
                            throws java.sql.SQLException
Specified by:
getResultSetHoldability in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetConcurrency

public int getResultSetConcurrency()
                            throws java.sql.SQLException
Specified by:
getResultSetConcurrency in interface java.sql.Statement
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
Specified by:
getConnection in interface java.sql.Statement

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
Specified by:
getWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
Specified by:
clearWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException

getGeneratedKeys

public java.sql.ResultSet getGeneratedKeys()
                                    throws java.sql.SQLException
Specified by:
getGeneratedKeys in interface java.sql.Statement
Throws:
java.sql.SQLException

getQueryTimeout

public int getQueryTimeout()
                    throws java.sql.SQLException
Specified by:
getQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException

setCursorName

public void setCursorName(java.lang.String s)
                   throws java.sql.SQLException
Specified by:
setCursorName in interface java.sql.Statement
Throws:
java.sql.SQLException

addBatch

public void addBatch(java.lang.String s)
              throws java.sql.SQLException
Specified by:
addBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

clearBatch

public void clearBatch()
                throws java.sql.SQLException
Specified by:
clearBatch in interface java.sql.Statement
Throws:
java.sql.SQLException

setEscapeProcessing

public void setEscapeProcessing(boolean f)
                         throws java.sql.SQLException
Specified by:
setEscapeProcessing in interface java.sql.Statement
Throws:
java.sql.SQLException

getMaxRows

public int getMaxRows()
               throws java.sql.SQLException
Specified by:
getMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException

setMaxRows

public void setMaxRows(int n)
                throws java.sql.SQLException
Specified by:
setMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException

getMaxFieldSize

public int getMaxFieldSize()
                    throws java.sql.SQLException
Specified by:
getMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException

setMaxFieldSize

public void setMaxFieldSize(int n)
                     throws java.sql.SQLException
Specified by:
setMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException

getFetchSize

public int getFetchSize()
                 throws java.sql.SQLException
Specified by:
getFetchSize in interface java.sql.Statement
Throws:
java.sql.SQLException

setFetchSize

public void setFetchSize(int n)
                  throws java.sql.SQLException
Specified by:
setFetchSize in interface java.sql.Statement
Throws:
java.sql.SQLException

getFetchDirection

public int getFetchDirection()
                      throws java.sql.SQLException
Specified by:
getFetchDirection in interface java.sql.Statement
Throws:
java.sql.SQLException

setFetchDirection

public void setFetchDirection(int n)
                       throws java.sql.SQLException
Specified by:
setFetchDirection in interface java.sql.Statement
Throws:
java.sql.SQLException

setQueryTimeout

public void setQueryTimeout(int n)
                     throws java.sql.SQLException
Specified by:
setQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException

cancel

public void cancel()
            throws java.sql.SQLException
Specified by:
cancel in interface java.sql.Statement
Throws:
java.sql.SQLException

getUpdateCount

public int getUpdateCount()
                   throws java.sql.SQLException
Specified by:
getUpdateCount in interface java.sql.Statement
Throws:
java.sql.SQLException