net.sourceforge.sqlunit.test.mock
Class SQLUnitMockConnection

java.lang.Object
  extended by com.mockrunner.mock.jdbc.MockConnection
      extended by net.sourceforge.sqlunit.test.mock.SQLUnitMockConnection
All Implemented Interfaces:
java.sql.Connection

public class SQLUnitMockConnection
extends com.mockrunner.mock.jdbc.MockConnection

Represents a Connection object that depends on an underlying IDatabase. Much of the functionality of the MockConnection object is reused, we extend behavior only where we need it.

Version:
$Revision: 1.2 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Field Summary
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
SQLUnitMockConnection()
           
 
Method Summary
 java.sql.Statement createStatement()
          Creates a SQLUnitMockStatement object.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
          Creates a SQLUnitMockStatement with the specified resultSetType and resultSetConcurrency.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Creates a SQLUnitMockStatement with the specified resultSetType, resultSetConcurrency and resultSetHoldability.
 com.mockrunner.jdbc.CallableStatementResultSetHandler getCallableStatementResultSetHandler()
          Override the superclass method to return an Introspecting handler.
 com.mockrunner.jdbc.PreparedStatementResultSetHandler getPreparedStatementResultSetHandler()
          Override the superclass method to return an Introspecting handler.
 com.mockrunner.jdbc.StatementResultSetHandler getStatementResultSetHandler()
          Override the superclass method to return an Introspecting handler.
 java.sql.CallableStatement prepareCall(java.lang.String sqlString)
          Creates a SQLUnitMockCallableStatement with the specified SQL string.
 java.sql.CallableStatement prepareCall(java.lang.String sqlString, int resultSetType, int resultSetConcurrency)
          Creates a SQLUnitMockCallableStatement with the specified SQL string, resultSetType and resultSetConcurrency.
 java.sql.CallableStatement prepareCall(java.lang.String sqlString, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Creates a SQLUnitMockCallableStatement with the specified SQL string, resultSetType, resultSetConcurrency and resultSetHoldability.
 java.sql.PreparedStatement prepareStatement(java.lang.String sqlString)
          Creates a SQLUnitMockPreparedStatement with the specified SQL string.
 java.sql.PreparedStatement prepareStatement(java.lang.String sqlString, int autoGeneratedKeys)
          Creates a SQLUnitMockPreparedStatement with the specified SQL string and the autoGenerated keys parameter.
 java.sql.PreparedStatement prepareStatement(java.lang.String sqlString, int[] columnIndexes)
          Creates a SQLUnitMockPreparedStatement with the specified SQL string and an int array of column indexes.
 java.sql.PreparedStatement prepareStatement(java.lang.String sqlString, int resultSetType, int resultSetConcurrency)
          Creates a SQLUnitMockPreparedStatement with the specified SQL string with the specified resultSetType and resultSetConcurrency.
 java.sql.PreparedStatement prepareStatement(java.lang.String sqlString, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          Creates a SQLUnitMockPreparedStatement with the specified SQL string with the specified resultSetType, resultSetConcurrency and resultSetHoldability.
 java.sql.PreparedStatement prepareStatement(java.lang.String sqlString, java.lang.String[] columnNames)
          Creates a SQLUnitMockPreparedStatement with the specified SQL string and an String array of column names.
 
Methods inherited from class com.mockrunner.mock.jdbc.MockConnection
clearWarnings, close, commit, getAutoCommit, getCatalog, getHoldability, getMetaData, getNumberCommits, getNumberRollbacks, getSavepointMap, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, releaseSavepoint, resetNumberCommits, resetNumberRollbacks, resetSavepointMap, rollback, rollback, setAutoCommit, setCatalog, setHoldability, setMetaData, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLUnitMockConnection

public SQLUnitMockConnection()
Method Detail

getStatementResultSetHandler

public com.mockrunner.jdbc.StatementResultSetHandler getStatementResultSetHandler()
Override the superclass method to return an Introspecting handler.

Overrides:
getStatementResultSetHandler in class com.mockrunner.mock.jdbc.MockConnection
Returns:
an IntrospectingStatementResultSetHandler object.

getPreparedStatementResultSetHandler

public final com.mockrunner.jdbc.PreparedStatementResultSetHandler getPreparedStatementResultSetHandler()
Override the superclass method to return an Introspecting handler.

Overrides:
getPreparedStatementResultSetHandler in class com.mockrunner.mock.jdbc.MockConnection
Returns:
an IntrospectingPreparedStatementResultSetHandler object.

getCallableStatementResultSetHandler

public final com.mockrunner.jdbc.CallableStatementResultSetHandler getCallableStatementResultSetHandler()
Override the superclass method to return an Introspecting handler.

Overrides:
getCallableStatementResultSetHandler in class com.mockrunner.mock.jdbc.MockConnection
Returns:
an IntrospectingCallableStatementResultSetHandler object.

createStatement

public final java.sql.Statement createStatement()
                                         throws java.sql.SQLException
Creates a SQLUnitMockStatement object.

Specified by:
createStatement in interface java.sql.Connection
Overrides:
createStatement in class com.mockrunner.mock.jdbc.MockConnection
Returns:
a SQLUnitMockStatement object.
Throws:
java.sql.SQLException - if there was an error.

createStatement

public final java.sql.Statement createStatement(int resultSetType,
                                                int resultSetConcurrency)
                                         throws java.sql.SQLException
Creates a SQLUnitMockStatement with the specified resultSetType and resultSetConcurrency. Delegates to the parameterless version of this method.

Specified by:
createStatement in interface java.sql.Connection
Overrides:
createStatement in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
resultSetType - the resultSetType to set.
resultSetConcurrency - the resultSetConcurrency to set.
Returns:
a Statement object.
Throws:
java.sql.SQLException - if there was an error.

createStatement

public final java.sql.Statement createStatement(int resultSetType,
                                                int resultSetConcurrency,
                                                int resultSetHoldability)
                                         throws java.sql.SQLException
Creates a SQLUnitMockStatement with the specified resultSetType, resultSetConcurrency and resultSetHoldability. Delegates to the parameterless version of this method.

Specified by:
createStatement in interface java.sql.Connection
Overrides:
createStatement in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
resultSetType - the resultSetType to set.
resultSetConcurrency - the resultSetConcurrency to set.
resultSetHoldability - the resultSetHoldability to set.
Returns:
a Statement object.
Throws:
java.sql.SQLException - if there was an error.

prepareCall

public final java.sql.CallableStatement prepareCall(java.lang.String sqlString)
                                             throws java.sql.SQLException
Creates a SQLUnitMockCallableStatement with the specified SQL string.

Specified by:
prepareCall in interface java.sql.Connection
Overrides:
prepareCall in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
Returns:
a SQLUnitMockCallableStatement object.
Throws:
java.sql.SQLException - if there was an error.

prepareCall

public final java.sql.CallableStatement prepareCall(java.lang.String sqlString,
                                                    int resultSetType,
                                                    int resultSetConcurrency)
                                             throws java.sql.SQLException
Creates a SQLUnitMockCallableStatement with the specified SQL string, resultSetType and resultSetConcurrency. Delegates to the one-parameter version of this method.

Specified by:
prepareCall in interface java.sql.Connection
Overrides:
prepareCall in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
resultSetType - the resultSetType to set.
resultSetConcurrency - the resultSetConcurrency to set.
Returns:
a SQLUnitMockCallableStatement object.
Throws:
java.sql.SQLException - if there was an error.

prepareCall

public final java.sql.CallableStatement prepareCall(java.lang.String sqlString,
                                                    int resultSetType,
                                                    int resultSetConcurrency,
                                                    int resultSetHoldability)
                                             throws java.sql.SQLException
Creates a SQLUnitMockCallableStatement with the specified SQL string, resultSetType, resultSetConcurrency and resultSetHoldability. Delegates to the one-parameter version of this method.

Specified by:
prepareCall in interface java.sql.Connection
Overrides:
prepareCall in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
resultSetType - the resultSetType to set.
resultSetConcurrency - the resultSetConcurrency to set.
resultSetHoldability - the resultSetHoldability to set.
Returns:
a SQLUnitMockCallableStatement object.
Throws:
java.sql.SQLException - if there was an error.

prepareStatement

public final java.sql.PreparedStatement prepareStatement(java.lang.String sqlString)
                                                  throws java.sql.SQLException
Creates a SQLUnitMockPreparedStatement with the specified SQL string.

Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
Returns:
a SQLUnitMockPreparedStatement object.
Throws:
java.sql.SQLException - if there was an error.

prepareStatement

public final java.sql.PreparedStatement prepareStatement(java.lang.String sqlString,
                                                         int resultSetType,
                                                         int resultSetConcurrency)
                                                  throws java.sql.SQLException
Creates a SQLUnitMockPreparedStatement with the specified SQL string with the specified resultSetType and resultSetConcurrency. Delegates to the one-parameter version of this method.

Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
resultSetType - the resultSetType to set.
resultSetConcurrency - the resultSetConcurrency to set.
Returns:
a SQLUnitMockPreparedStatement object.
Throws:
java.sql.SQLException - if there was an error.

prepareStatement

public final java.sql.PreparedStatement prepareStatement(java.lang.String sqlString,
                                                         int resultSetType,
                                                         int resultSetConcurrency,
                                                         int resultSetHoldability)
                                                  throws java.sql.SQLException
Creates a SQLUnitMockPreparedStatement with the specified SQL string with the specified resultSetType, resultSetConcurrency and resultSetHoldability. Delegates to the one-parameter version of this method.

Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
resultSetType - the resultSetType to set.
resultSetConcurrency - the resultSetConcurrency to set.
resultSetHoldability - the resultSetHoldability to set.
Returns:
a SQLUnitMockPreparedStatement object.
Throws:
java.sql.SQLException - if there was an error.

prepareStatement

public final java.sql.PreparedStatement prepareStatement(java.lang.String sqlString,
                                                         int autoGeneratedKeys)
                                                  throws java.sql.SQLException
Creates a SQLUnitMockPreparedStatement with the specified SQL string and the autoGenerated keys parameter. Delegates to the one-parameter version of this method.

Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
autoGeneratedKeys - the autoGeneratedKeys to set.
Returns:
a SQLUnitMockPreparedStatement object.
Throws:
java.sql.SQLException - if there was an error.

prepareStatement

public final java.sql.PreparedStatement prepareStatement(java.lang.String sqlString,
                                                         int[] columnIndexes)
                                                  throws java.sql.SQLException
Creates a SQLUnitMockPreparedStatement with the specified SQL string and an int array of column indexes. Delegates to the one-parameter version of this method.

Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
columnIndexes - an int array of column indexes.
Returns:
a SQLUnitMockPreparedStatement object.
Throws:
java.sql.SQLException - if there was an error.

prepareStatement

public final java.sql.PreparedStatement prepareStatement(java.lang.String sqlString,
                                                         java.lang.String[] columnNames)
                                                  throws java.sql.SQLException
Creates a SQLUnitMockPreparedStatement with the specified SQL string and an String array of column names. Delegates to the one-parameter version of this method.

Specified by:
prepareStatement in interface java.sql.Connection
Overrides:
prepareStatement in class com.mockrunner.mock.jdbc.MockConnection
Parameters:
sqlString - the SQL string to execute.
columnNames - a String array of column names.
Returns:
a SQLUnitMockPreparedStatement object.
Throws:
java.sql.SQLException - if there was an error.