Package com.mockobjects.sql

# Class MockPreparedStatement

java.lang.Object
com.mockobjects.MockObject
com.mockobjects.sql.MockPreparedStatement

All Implemented Interfaces:
  `Verifiable`, `AutoCloseable`, `PreparedStatement`, `Statement`, `Wrapper`

public class MockPreparedStatement extends MockObject

## Field Summary

### 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

Constructors
Constructor
Description
`MockPreparedStatement()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addBatch()`
Calls notImplemented.
`void`
`addBatch(String sql)`
`void`
`addExpectedExecute(String queryString, boolean success)`
`void`
`addExpectedExecuteQuery(String queryString, ResultSet resultSet)`
`void`
`addExpectedExecuteUpdate(String queryString, int updateCount)`
`void`
`addExpectedSetParameter(int parameterIndex, int intValue)`
`void`
`addExpectedSetParameter(int parameterIndex, Object parameterValue)`
`void`
`addExpectedSetParameters(Object[] parameters)`
`void`
`addExpectedTargetSQLType(int aTargetSQLType)`
`void`
`addResultSet(com.mockobjects.sql.MockResultSet aResultSet)`
`void`
`addUpdateCount(int count)`
Added value to be returned by executeUpdate()
`void`
`cancel()`
`void`
`clearBatch()`
`void`
`clearParameters()`
`void`
`clearWarnings()`
`void`
`close()`
`boolean`
`execute()`
Calls innerExecute() (see CommonMockStatement).
`boolean`
`execute(String sql)`
`int[]`
`executeBatch()`
`ResultSet`
`executeQuery()`
Returns executeQuery(String) with an empty String.
`ResultSet`
`executeQuery(String sql)`
`int`
`executeUpdate()`
Returns value set with addUpdateCount
`int`
`executeUpdate(String sql)`
`Connection`
`getConnection()`
`int`
`getFetchDirection()`
`int`
`getFetchSize()`
`int`
`getMaxFieldSize()`
`int`
`getMaxRows()`
`ResultSetMetaData`
`getMetaData()`
Calls notImplemented.
`boolean`
`getMoreResults()`
`int`
`getQueryTimeout()`
`ResultSet`
`getResultSet()`
`int`
`getResultSetConcurrency()`
`int`
`getResultSetType()`
`int`
`getUpdateCount()`
`SQLWarning`
`getWarnings()`
`void`
`setArray(int param, Array array)`
`void`
`setAsciiStream(int param, InputStream inputStream, int length)`
Calls notImplemented.
`void`
`setBigDecimal(int param, BigDecimal bigDecimal)`
`void`
`setBinaryStream(int param, InputStream inputStream, int length)`
Calls notImplemented.
`void`
`setBlob(int param, Blob blob)`
`void`
`setBoolean(int param, boolean aBoolean)`
`void`
`setByte(int param, byte aByte)`
`void`
`setBytes(int param, byte[] values)`
`void`
`setCharacterStream(int param, Reader reader, int length)`
Calls notImplemented.
`void`
`setClob(int param, Clob clob)`
`void`
`setCursorName(String name)`
`void`
`setDate(int param, Date date)`
`void`
`setDate(int param, Date date, Calendar calendar)`
`void`
`setDouble(int param, double aDouble)`
`void`
`setEscapeProcessing(boolean enable)`
`void`
`setExpectedClearParametersCalls(int callCount)`
`void`
`setExpectedCloseCalls(int callCount)`
`void`
`setExpectingNoSetParameters()`
`void`
`setFetchDirection(int direction)`
`void`
`setFetchSize(int rows)`
`void`
`setFloat(int param, float aFloat)`
`void`
`setInt(int parameterIndex, int x)`
`void`
`setLong(int param, long aLong)`
`void`
`setMaxFieldSize(int max)`
`void`
`setMaxRows(int max)`
`void`
`setNull(int param, int param1)`
`void`
`setNull(int param, int param1, String typeName)`
Calls notImplemented.
`void`
`setObject(int param, Object anObject)`
`void`
`setObject(int param, Object anObject, int aTargetSQLType)`
`void`
`setObject(int param, Object anObject, int targetSqlType, int scale)`
Calls notImplemented.
`void`
`setQueryTimeout(int seconds)`
`void`
`setRef(int param, Ref ref)`
`void`
`setShort(int param, short aShort)`
`void`
`setString(int parameterIndex, String x)`
`void`
`setTime(int param, Time time)`
`void`
`setTime(int param, Time time, Calendar calendar)`
`void`
`setTimestamp(int param, Timestamp timestamp)`
`void`
`setTimestamp(int param, Timestamp timestamp, Calendar calendar)`
Calls notImplemented.
`void`
`setUnicodeStream(int param, InputStream inputStream, int length)`
Calls notImplemented.
`void`
`setupConnection(Connection conn)`
`void`
`setupThrowExceptionOnExecute(SQLException exception)`
`void`
`setupUpdateCount(int updateCount)`

### Methods inherited from class com.mockobjects.MockObject

`notImplemented, notYetImplemented, verify`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.sql.PreparedStatement

`executeLargeUpdate, getParameterMetaData, setAsciiStream, setAsciiStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setCharacterStream, setCharacterStream, setClob, setClob, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setObject, setObject, setRowId, setSQLXML, setURL`

### Methods inherited from interface java.sql.Statement

`addBatch, cancel, clearBatch, clearWarnings, close, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout`

### Methods inherited from interface java.sql.Wrapper

`isWrapperFor, unwrap`

## Constructor Details

### MockPreparedStatement

public MockPreparedStatement()

## Method Details

### addResultSet

public void addResultSet(com.mockobjects.sql.MockResultSet aResultSet)

### addExpectedSetParameter

public void addExpectedSetParameter(int parameterIndex, int intValue)

### addExpectedSetParameter

public void addExpectedSetParameter(int parameterIndex, Object parameterValue)

### addExpectedSetParameters

public void addExpectedSetParameters(Object[] parameters)

### addExpectedTargetSQLType

public void addExpectedTargetSQLType(int aTargetSQLType)

### setExpectedClearParametersCalls

public void setExpectedClearParametersCalls(int callCount)

### setExpectingNoSetParameters

public void setExpectingNoSetParameters()

### clearParameters

public void clearParameters() throws SQLException

Specified by:
  `clearParameters` in interface `PreparedStatement`
Throws:
  `SQLException`

### execute

public boolean execute() throws SQLException
Calls innerExecute() (see CommonMockStatement). Returns false.

Specified by:
  `execute` in interface `PreparedStatement`
Throws:
  `SQLException`

### executeQuery

public ResultSet executeQuery() throws SQLException
Returns executeQuery(String) with an empty String.

Specified by:
  `executeQuery` in interface `PreparedStatement`
Throws:
  `SQLException`

### addUpdateCount

public void addUpdateCount(int count)
Added value to be returned by executeUpdate()

Parameters:
  `count` -
See Also:
  - `PreparedStatement.executeUpdate()`

### executeUpdate

public int executeUpdate() throws SQLException
Returns value set with addUpdateCount

Specified by:
  `executeUpdate` in interface `PreparedStatement`
Throws:
  `SQLException`
See Also:
  - `addUpdateCount(int)`

### setInt

public void setInt(int parameterIndex, int x) throws SQLException

Specified by:
  `setInt` in interface `PreparedStatement`
Throws:
  `SQLException`

### setString

public void setString(int parameterIndex, String x) throws SQLException

Specified by:
  `setString` in interface `PreparedStatement`
Throws:
  `SQLException`

### setTimestamp

public void setTimestamp(int param, Timestamp timestamp) throws SQLException

Specified by:
  `setTimestamp` in interface `PreparedStatement`
Throws:
  `SQLException`

### setClob

public void setClob(int param, Clob clob) throws SQLException

Specified by:
  `setClob` in interface `PreparedStatement`
Throws:
  `SQLException`

### setLong

public void setLong(int param, long aLong) throws SQLException

Specified by:
  `setLong` in interface `PreparedStatement`
Throws:
  `SQLException`

### setNull

public void setNull(int param, int param1) throws SQLException

Specified by:
  `setNull` in interface `PreparedStatement`
Throws:
  `SQLException`

### setArray

public void setArray(int param, Array array) throws SQLException

Specified by:
  `setArray` in interface `PreparedStatement`
Throws:
  `SQLException`

### setShort

public void setShort(int param, short aShort) throws SQLException

Specified by:
  `setShort` in interface `PreparedStatement`
Throws:
  `SQLException`

### setTime

public void setTime(int param, Time time, Calendar calendar) throws SQLException

Specified by:
  `setTime` in interface `PreparedStatement`
Throws:
  `SQLException`

### setObject

public void setObject(int param, Object anObject, int aTargetSQLType) throws SQLException

Specified by:
  `setObject` in interface `PreparedStatement`
Throws:
  `SQLException`

### setRef

public void setRef(int param, Ref ref) throws SQLException

Specified by:
  `setRef` in interface `PreparedStatement`
Throws:
  `SQLException`

### setDate

public void setDate(int param, Date date) throws SQLException

Specified by:
  `setDate` in interface `PreparedStatement`
Throws:
  `SQLException`

### setFloat

public void setFloat(int param, float aFloat) throws SQLException

Specified by:
  `setFloat` in interface `PreparedStatement`
Throws:
  `SQLException`

### setBlob

public void setBlob(int param, Blob blob) throws SQLException

Specified by:
  `setBlob` in interface `PreparedStatement`
Throws:
  `SQLException`

### setDate

public void setDate(int param, Date date, Calendar calendar) throws SQLException

Specified by:
  `setDate` in interface `PreparedStatement`
Throws:
  `SQLException`

### setBytes

public void setBytes(int param, byte[] values) throws SQLException

Specified by:
  `setBytes` in interface `PreparedStatement`
Throws:
  `SQLException`

### setObject

public void setObject(int param, Object anObject) throws SQLException

Specified by:
  `setObject` in interface `PreparedStatement`
Throws:
  `SQLException`

### setByte

public void setByte(int param, byte aByte) throws SQLException

Specified by:
  `setByte` in interface `PreparedStatement`
Throws:
  `SQLException`

### setDouble

public void setDouble(int param, double aDouble) throws SQLException

Specified by:
  `setDouble` in interface `PreparedStatement`
Throws:
  `SQLException`

### setTime

public void setTime(int param, Time time) throws SQLException

Specified by:
  `setTime` in interface `PreparedStatement`
Throws:
  `SQLException`

### setBoolean

public void setBoolean(int param, boolean aBoolean) throws SQLException

Specified by:
  `setBoolean` in interface `PreparedStatement`
Throws:
  `SQLException`

### setBigDecimal

public void setBigDecimal(int param, BigDecimal bigDecimal) throws SQLException

Specified by:
  `setBigDecimal` in interface `PreparedStatement`
Throws:
  `SQLException`

### addBatch

public void addBatch() throws SQLException
Calls notImplemented.

Specified by:
  `addBatch` in interface `PreparedStatement`
Throws:
  `SQLException`

### setObject

public void setObject(int param, Object anObject, int targetSqlType, int scale) throws SQLException
Calls notImplemented.

Specified by:
  `setObject` in interface `PreparedStatement`
Throws:
  `SQLException`

### setCharacterStream

public void setCharacterStream(int param, Reader reader, int length) throws SQLException
Calls notImplemented.

Specified by:
  `setCharacterStream` in interface `PreparedStatement`
Throws:
  `SQLException`

### setAsciiStream

public void setAsciiStream(int param, InputStream inputStream, int length) throws SQLException
Calls notImplemented.

Specified by:
  `setAsciiStream` in interface `PreparedStatement`
Throws:
  `SQLException`

### setBinaryStream

public void setBinaryStream(int param, InputStream inputStream, int length) throws SQLException
Calls notImplemented.

Specified by:
  `setBinaryStream` in interface `PreparedStatement`
Throws:
  `SQLException`

### setNull

public void setNull(int param, int param1, String typeName) throws SQLException
Calls notImplemented.

Specified by:
  `setNull` in interface `PreparedStatement`
Throws:
  `SQLException`

### setUnicodeStream

public void setUnicodeStream(int param, InputStream inputStream, int length) throws SQLException
Calls notImplemented.

Specified by:
  `setUnicodeStream` in interface `PreparedStatement`
Throws:
  `SQLException`

### getMetaData

public ResultSetMetaData getMetaData() throws SQLException
Calls notImplemented. Returns null.

Specified by:
  `getMetaData` in interface `PreparedStatement`
Throws:
  `SQLException`

### setTimestamp

public void setTimestamp(int param, Timestamp timestamp, Calendar calendar) throws SQLException
Calls notImplemented.

Specified by:
  `setTimestamp` in interface `PreparedStatement`
Throws:
  `SQLException`

### addExpectedExecuteQuery

public void addExpectedExecuteQuery(String queryString, ResultSet resultSet)

### addExpectedExecuteUpdate

public void addExpectedExecuteUpdate(String queryString, int updateCount)

### addExpectedExecute

public void addExpectedExecute(String queryString, boolean success)

### setExpectedCloseCalls

public void setExpectedCloseCalls(int callCount)

### setupConnection

public void setupConnection(Connection conn)

### setupThrowExceptionOnExecute

public void setupThrowExceptionOnExecute(SQLException exception)

### setupUpdateCount

public void setupUpdateCount(int updateCount)

### close

public void close() throws SQLException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Statement`
Throws:
  `SQLException`

### execute

public boolean execute(String sql) throws SQLException

Specified by:
  `execute` in interface `Statement`
Throws:
  `SQLException`

### executeQuery

public ResultSet executeQuery(String sql) throws SQLException

Specified by:
  `executeQuery` in interface `Statement`
Throws:
  `SQLException`

### executeUpdate

public int executeUpdate(String sql) throws SQLException

Specified by:
  `executeUpdate` in interface `Statement`
Throws:
  `SQLException`

### getMaxFieldSize

public int getMaxFieldSize() throws SQLException

Specified by:
  `getMaxFieldSize` in interface `Statement`
Throws:
  `SQLException`

### setMaxFieldSize

public void setMaxFieldSize(int max) throws SQLException

Specified by:
  `setMaxFieldSize` in interface `Statement`
Throws:
  `SQLException`

### getMaxRows

public int getMaxRows() throws SQLException

Specified by:
  `getMaxRows` in interface `Statement`
Throws:
  `SQLException`

### setMaxRows

public void setMaxRows(int max) throws SQLException

Specified by:
  `setMaxRows` in interface `Statement`
Throws:
  `SQLException`

### setEscapeProcessing

public void setEscapeProcessing(boolean enable) throws SQLException

Specified by:
  `setEscapeProcessing` in interface `Statement`
Throws:
  `SQLException`

### getQueryTimeout

public int getQueryTimeout() throws SQLException

Specified by:
  `getQueryTimeout` in interface `Statement`
Throws:
  `SQLException`

### setQueryTimeout

public void setQueryTimeout(int seconds) throws SQLException

Specified by:
  `setQueryTimeout` in interface `Statement`
Throws:
  `SQLException`

### cancel

public void cancel() throws SQLException

Specified by:
  `cancel` in interface `Statement`
Throws:
  `SQLException`

### getWarnings

public SQLWarning getWarnings() throws SQLException

Specified by:
  `getWarnings` in interface `Statement`
Throws:
  `SQLException`

### clearWarnings

public void clearWarnings() throws SQLException

Specified by:
  `clearWarnings` in interface `Statement`
Throws:
  `SQLException`

### setCursorName

public void setCursorName(String name) throws SQLException

Specified by:
  `setCursorName` in interface `Statement`
Throws:
  `SQLException`

### getResultSet

public ResultSet getResultSet() throws SQLException

Specified by:
  `getResultSet` in interface `Statement`
Throws:
  `SQLException`

### getUpdateCount

public int getUpdateCount() throws SQLException

Specified by:
  `getUpdateCount` in interface `Statement`
Throws:
  `SQLException`

### getMoreResults

public boolean getMoreResults() throws SQLException

Specified by:
  `getMoreResults` in interface `Statement`
Throws:
  `SQLException`

### setFetchDirection

public void setFetchDirection(int direction) throws SQLException

Specified by:
  `setFetchDirection` in interface `Statement`
Throws:
  `SQLException`

### getFetchDirection

public int getFetchDirection() throws SQLException

Specified by:
  `getFetchDirection` in interface `Statement`
Throws:
  `SQLException`

### setFetchSize

public void setFetchSize(int rows) throws SQLException

Specified by:
  `setFetchSize` in interface `Statement`
Throws:
  `SQLException`

### getFetchSize

public int getFetchSize() throws SQLException

Specified by:
  `getFetchSize` in interface `Statement`
Throws:
  `SQLException`

### getResultSetConcurrency

public int getResultSetConcurrency() throws SQLException

Specified by:
  `getResultSetConcurrency` in interface `Statement`
Throws:
  `SQLException`

### getResultSetType

public int getResultSetType() throws SQLException

Specified by:
  `getResultSetType` in interface `Statement`
Throws:
  `SQLException`

### addBatch

public void addBatch(String sql) throws SQLException

Specified by:
  `addBatch` in interface `Statement`
Throws:
  `SQLException`

### clearBatch

public void clearBatch() throws SQLException

Specified by:
  `clearBatch` in interface `Statement`
Throws:
  `SQLException`

### executeBatch

public int[] executeBatch() throws SQLException

Specified by:
  `executeBatch` in interface `Statement`
Throws:
  `SQLException`

### getConnection

public Connection getConnection() throws SQLException

Specified by:
  `getConnection` in interface `Statement`
Throws:
  `SQLException`