Package com.mockobjects.sql
Class MockPreparedStatement
java.lang.Object
com.mockobjects.MockObject
com.mockobjects.sql.MockPreparedStatement
- All Implemented Interfaces:
Verifiable
,AutoCloseable
,PreparedStatement
,Statement
,Wrapper
-
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBatch()
Calls notImplemented.void
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
void
void
void
close()
boolean
execute()
Calls innerExecute() (see CommonMockStatement).boolean
int[]
Returns executeQuery(String) with an empty String.executeQuery
(String sql) int
Returns value set with addUpdateCountint
executeUpdate
(String sql) int
int
int
int
Calls notImplemented.boolean
int
int
int
int
void
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
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
void
setCursorName
(String name) void
void
void
setDouble
(int param, double aDouble) void
setEscapeProcessing
(boolean enable) void
setExpectedClearParametersCalls
(int callCount) void
setExpectedCloseCalls
(int callCount) void
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
Calls notImplemented.void
void
void
Calls notImplemented.void
setQueryTimeout
(int seconds) void
void
setShort
(int param, short aShort) void
void
void
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
-
addExpectedSetParameters
-
addExpectedTargetSQLType
public void addExpectedTargetSQLType(int aTargetSQLType) -
setExpectedClearParametersCalls
public void setExpectedClearParametersCalls(int callCount) -
setExpectingNoSetParameters
public void setExpectingNoSetParameters() -
clearParameters
- Specified by:
clearParameters
in interfacePreparedStatement
- Throws:
SQLException
-
execute
Calls innerExecute() (see CommonMockStatement). Returns false.- Specified by:
execute
in interfacePreparedStatement
- Throws:
SQLException
-
executeQuery
Returns executeQuery(String) with an empty String.- Specified by:
executeQuery
in interfacePreparedStatement
- Throws:
SQLException
-
addUpdateCount
public void addUpdateCount(int count) Added value to be returned by executeUpdate()- Parameters:
count
-- See Also:
-
executeUpdate
Returns value set with addUpdateCount- Specified by:
executeUpdate
in interfacePreparedStatement
- Throws:
SQLException
- See Also:
-
setInt
- Specified by:
setInt
in interfacePreparedStatement
- Throws:
SQLException
-
setString
- Specified by:
setString
in interfacePreparedStatement
- Throws:
SQLException
-
setTimestamp
- Specified by:
setTimestamp
in interfacePreparedStatement
- Throws:
SQLException
-
setClob
- Specified by:
setClob
in interfacePreparedStatement
- Throws:
SQLException
-
setLong
- Specified by:
setLong
in interfacePreparedStatement
- Throws:
SQLException
-
setNull
- Specified by:
setNull
in interfacePreparedStatement
- Throws:
SQLException
-
setArray
- Specified by:
setArray
in interfacePreparedStatement
- Throws:
SQLException
-
setShort
- Specified by:
setShort
in interfacePreparedStatement
- Throws:
SQLException
-
setTime
- Specified by:
setTime
in interfacePreparedStatement
- Throws:
SQLException
-
setObject
- Specified by:
setObject
in interfacePreparedStatement
- Throws:
SQLException
-
setRef
- Specified by:
setRef
in interfacePreparedStatement
- Throws:
SQLException
-
setDate
- Specified by:
setDate
in interfacePreparedStatement
- Throws:
SQLException
-
setFloat
- Specified by:
setFloat
in interfacePreparedStatement
- Throws:
SQLException
-
setBlob
- Specified by:
setBlob
in interfacePreparedStatement
- Throws:
SQLException
-
setDate
- Specified by:
setDate
in interfacePreparedStatement
- Throws:
SQLException
-
setBytes
- Specified by:
setBytes
in interfacePreparedStatement
- Throws:
SQLException
-
setObject
- Specified by:
setObject
in interfacePreparedStatement
- Throws:
SQLException
-
setByte
- Specified by:
setByte
in interfacePreparedStatement
- Throws:
SQLException
-
setDouble
- Specified by:
setDouble
in interfacePreparedStatement
- Throws:
SQLException
-
setTime
- Specified by:
setTime
in interfacePreparedStatement
- Throws:
SQLException
-
setBoolean
- Specified by:
setBoolean
in interfacePreparedStatement
- Throws:
SQLException
-
setBigDecimal
- Specified by:
setBigDecimal
in interfacePreparedStatement
- Throws:
SQLException
-
addBatch
Calls notImplemented.- Specified by:
addBatch
in interfacePreparedStatement
- Throws:
SQLException
-
setObject
Calls notImplemented.- Specified by:
setObject
in interfacePreparedStatement
- Throws:
SQLException
-
setCharacterStream
Calls notImplemented.- Specified by:
setCharacterStream
in interfacePreparedStatement
- Throws:
SQLException
-
setAsciiStream
Calls notImplemented.- Specified by:
setAsciiStream
in interfacePreparedStatement
- Throws:
SQLException
-
setBinaryStream
Calls notImplemented.- Specified by:
setBinaryStream
in interfacePreparedStatement
- Throws:
SQLException
-
setNull
Calls notImplemented.- Specified by:
setNull
in interfacePreparedStatement
- Throws:
SQLException
-
setUnicodeStream
Calls notImplemented.- Specified by:
setUnicodeStream
in interfacePreparedStatement
- Throws:
SQLException
-
getMetaData
Calls notImplemented. Returns null.- Specified by:
getMetaData
in interfacePreparedStatement
- Throws:
SQLException
-
setTimestamp
Calls notImplemented.- Specified by:
setTimestamp
in interfacePreparedStatement
- Throws:
SQLException
-
addExpectedExecuteQuery
-
addExpectedExecuteUpdate
-
addExpectedExecute
-
setExpectedCloseCalls
public void setExpectedCloseCalls(int callCount) -
setupConnection
-
setupThrowExceptionOnExecute
-
setupUpdateCount
public void setupUpdateCount(int updateCount) -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceStatement
- Throws:
SQLException
-
execute
- Specified by:
execute
in interfaceStatement
- Throws:
SQLException
-
executeQuery
- Specified by:
executeQuery
in interfaceStatement
- Throws:
SQLException
-
executeUpdate
- Specified by:
executeUpdate
in interfaceStatement
- Throws:
SQLException
-
getMaxFieldSize
- Specified by:
getMaxFieldSize
in interfaceStatement
- Throws:
SQLException
-
setMaxFieldSize
- Specified by:
setMaxFieldSize
in interfaceStatement
- Throws:
SQLException
-
getMaxRows
- Specified by:
getMaxRows
in interfaceStatement
- Throws:
SQLException
-
setMaxRows
- Specified by:
setMaxRows
in interfaceStatement
- Throws:
SQLException
-
setEscapeProcessing
- Specified by:
setEscapeProcessing
in interfaceStatement
- Throws:
SQLException
-
getQueryTimeout
- Specified by:
getQueryTimeout
in interfaceStatement
- Throws:
SQLException
-
setQueryTimeout
- Specified by:
setQueryTimeout
in interfaceStatement
- Throws:
SQLException
-
cancel
- Specified by:
cancel
in interfaceStatement
- Throws:
SQLException
-
getWarnings
- Specified by:
getWarnings
in interfaceStatement
- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarnings
in interfaceStatement
- Throws:
SQLException
-
setCursorName
- Specified by:
setCursorName
in interfaceStatement
- Throws:
SQLException
-
getResultSet
- Specified by:
getResultSet
in interfaceStatement
- Throws:
SQLException
-
getUpdateCount
- Specified by:
getUpdateCount
in interfaceStatement
- Throws:
SQLException
-
getMoreResults
- Specified by:
getMoreResults
in interfaceStatement
- Throws:
SQLException
-
setFetchDirection
- Specified by:
setFetchDirection
in interfaceStatement
- Throws:
SQLException
-
getFetchDirection
- Specified by:
getFetchDirection
in interfaceStatement
- Throws:
SQLException
-
setFetchSize
- Specified by:
setFetchSize
in interfaceStatement
- Throws:
SQLException
-
getFetchSize
- Specified by:
getFetchSize
in interfaceStatement
- Throws:
SQLException
-
getResultSetConcurrency
- Specified by:
getResultSetConcurrency
in interfaceStatement
- Throws:
SQLException
-
getResultSetType
- Specified by:
getResultSetType
in interfaceStatement
- Throws:
SQLException
-
addBatch
- Specified by:
addBatch
in interfaceStatement
- Throws:
SQLException
-
clearBatch
- Specified by:
clearBatch
in interfaceStatement
- Throws:
SQLException
-
executeBatch
- Specified by:
executeBatch
in interfaceStatement
- Throws:
SQLException
-
getConnection
- Specified by:
getConnection
in interfaceStatement
- Throws:
SQLException
-