Package com.mockobjects.sql
Class MockPreparedStatement
- java.lang.Object
-
- com.mockobjects.MockObject
-
- com.mockobjects.sql.MockPreparedStatement
-
- All Implemented Interfaces:
Verifiable,java.lang.AutoCloseable,java.sql.PreparedStatement,java.sql.Statement,java.sql.Wrapper
public class MockPreparedStatement extends MockObject
-
-
Constructor Summary
Constructors Constructor Description MockPreparedStatement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBatch()Calls notImplemented.voidaddBatch(java.lang.String sql)voidaddExpectedExecute(java.lang.String queryString, boolean success)voidaddExpectedExecuteQuery(java.lang.String queryString, java.sql.ResultSet resultSet)voidaddExpectedExecuteUpdate(java.lang.String queryString, int updateCount)voidaddExpectedSetParameter(int parameterIndex, int intValue)voidaddExpectedSetParameter(int parameterIndex, java.lang.Object parameterValue)voidaddExpectedSetParameters(java.lang.Object[] parameters)voidaddExpectedTargetSQLType(int aTargetSQLType)voidaddResultSet(com.mockobjects.sql.MockResultSet aResultSet)voidaddUpdateCount(int count)Added value to be returned by executeUpdate()voidcancel()voidclearBatch()voidclearParameters()voidclearWarnings()voidclose()booleanexecute()Calls innerExecute() (see CommonMockStatement).booleanexecute(java.lang.String sql)int[]executeBatch()java.sql.ResultSetexecuteQuery()Returns executeQuery(String) with an empty String.java.sql.ResultSetexecuteQuery(java.lang.String sql)intexecuteUpdate()Returns value set with addUpdateCountintexecuteUpdate(java.lang.String sql)java.sql.ConnectiongetConnection()intgetFetchDirection()intgetFetchSize()intgetMaxFieldSize()intgetMaxRows()java.sql.ResultSetMetaDatagetMetaData()Calls notImplemented.booleangetMoreResults()intgetQueryTimeout()java.sql.ResultSetgetResultSet()intgetResultSetConcurrency()intgetResultSetType()intgetUpdateCount()java.sql.SQLWarninggetWarnings()voidsetArray(int param, java.sql.Array array)voidsetAsciiStream(int param, java.io.InputStream inputStream, int length)Calls notImplemented.voidsetBigDecimal(int param, java.math.BigDecimal bigDecimal)voidsetBinaryStream(int param, java.io.InputStream inputStream, int length)Calls notImplemented.voidsetBlob(int param, java.sql.Blob blob)voidsetBoolean(int param, boolean aBoolean)voidsetByte(int param, byte aByte)voidsetBytes(int param, byte[] values)voidsetCharacterStream(int param, java.io.Reader reader, int length)Calls notImplemented.voidsetClob(int param, java.sql.Clob clob)voidsetCursorName(java.lang.String name)voidsetDate(int param, java.sql.Date date)voidsetDate(int param, java.sql.Date date, java.util.Calendar calendar)voidsetDouble(int param, double aDouble)voidsetEscapeProcessing(boolean enable)voidsetExpectedClearParametersCalls(int callCount)voidsetExpectedCloseCalls(int callCount)voidsetExpectingNoSetParameters()voidsetFetchDirection(int direction)voidsetFetchSize(int rows)voidsetFloat(int param, float aFloat)voidsetInt(int parameterIndex, int x)voidsetLong(int param, long aLong)voidsetMaxFieldSize(int max)voidsetMaxRows(int max)voidsetNull(int param, int param1)voidsetNull(int param, int param1, java.lang.String typeName)Calls notImplemented.voidsetObject(int param, java.lang.Object anObject)voidsetObject(int param, java.lang.Object anObject, int aTargetSQLType)voidsetObject(int param, java.lang.Object anObject, int targetSqlType, int scale)Calls notImplemented.voidsetQueryTimeout(int seconds)voidsetRef(int param, java.sql.Ref ref)voidsetShort(int param, short aShort)voidsetString(int parameterIndex, java.lang.String x)voidsetTime(int param, java.sql.Time time)voidsetTime(int param, java.sql.Time time, java.util.Calendar calendar)voidsetTimestamp(int param, java.sql.Timestamp timestamp)voidsetTimestamp(int param, java.sql.Timestamp timestamp, java.util.Calendar calendar)Calls notImplemented.voidsetUnicodeStream(int param, java.io.InputStream inputStream, int length)Calls notImplemented.voidsetupConnection(java.sql.Connection conn)voidsetupThrowExceptionOnExecute(java.sql.SQLException exception)voidsetupUpdateCount(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
-
-
-
-
Method Detail
-
addResultSet
public void addResultSet(com.mockobjects.sql.MockResultSet aResultSet)
-
addExpectedSetParameter
public void addExpectedSetParameter(int parameterIndex, int intValue)
-
addExpectedSetParameter
public void addExpectedSetParameter(int parameterIndex, java.lang.Object parameterValue)
-
addExpectedSetParameters
public void addExpectedSetParameters(java.lang.Object[] parameters)
-
addExpectedTargetSQLType
public void addExpectedTargetSQLType(int aTargetSQLType)
-
setExpectedClearParametersCalls
public void setExpectedClearParametersCalls(int callCount)
-
setExpectingNoSetParameters
public void setExpectingNoSetParameters()
-
clearParameters
public void clearParameters() throws java.sql.SQLException- Specified by:
clearParametersin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
execute
public boolean execute() throws java.sql.SQLExceptionCalls innerExecute() (see CommonMockStatement). Returns false.- Specified by:
executein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
executeQuery
public java.sql.ResultSet executeQuery() throws java.sql.SQLExceptionReturns executeQuery(String) with an empty String.- Specified by:
executeQueryin interfacejava.sql.PreparedStatement- Throws:
java.sql.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 java.sql.SQLExceptionReturns value set with addUpdateCount- Specified by:
executeUpdatein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException- See Also:
addUpdateCount(int)
-
setInt
public void setInt(int parameterIndex, int x) throws java.sql.SQLException- Specified by:
setIntin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setString
public void setString(int parameterIndex, java.lang.String x) throws java.sql.SQLException- Specified by:
setStringin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTimestamp
public void setTimestamp(int param, java.sql.Timestamp timestamp) throws java.sql.SQLException- Specified by:
setTimestampin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setClob
public void setClob(int param, java.sql.Clob clob) throws java.sql.SQLException- Specified by:
setClobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setLong
public void setLong(int param, long aLong) throws java.sql.SQLException- Specified by:
setLongin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNull
public void setNull(int param, int param1) throws java.sql.SQLException- Specified by:
setNullin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setArray
public void setArray(int param, java.sql.Array array) throws java.sql.SQLException- Specified by:
setArrayin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setShort
public void setShort(int param, short aShort) throws java.sql.SQLException- Specified by:
setShortin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTime
public void setTime(int param, java.sql.Time time, java.util.Calendar calendar) throws java.sql.SQLException- Specified by:
setTimein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setObject
public void setObject(int param, java.lang.Object anObject, int aTargetSQLType) throws java.sql.SQLException- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setRef
public void setRef(int param, java.sql.Ref ref) throws java.sql.SQLException- Specified by:
setRefin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setDate
public void setDate(int param, java.sql.Date date) throws java.sql.SQLException- Specified by:
setDatein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setFloat
public void setFloat(int param, float aFloat) throws java.sql.SQLException- Specified by:
setFloatin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBlob
public void setBlob(int param, java.sql.Blob blob) throws java.sql.SQLException- Specified by:
setBlobin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setDate
public void setDate(int param, java.sql.Date date, java.util.Calendar calendar) throws java.sql.SQLException- Specified by:
setDatein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBytes
public void setBytes(int param, byte[] values) throws java.sql.SQLException- Specified by:
setBytesin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setObject
public void setObject(int param, java.lang.Object anObject) throws java.sql.SQLException- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setByte
public void setByte(int param, byte aByte) throws java.sql.SQLException- Specified by:
setBytein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setDouble
public void setDouble(int param, double aDouble) throws java.sql.SQLException- Specified by:
setDoublein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTime
public void setTime(int param, java.sql.Time time) throws java.sql.SQLException- Specified by:
setTimein interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBoolean
public void setBoolean(int param, boolean aBoolean) throws java.sql.SQLException- Specified by:
setBooleanin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBigDecimal
public void setBigDecimal(int param, java.math.BigDecimal bigDecimal) throws java.sql.SQLException- Specified by:
setBigDecimalin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
addBatch
public void addBatch() throws java.sql.SQLExceptionCalls notImplemented.- Specified by:
addBatchin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setObject
public void setObject(int param, java.lang.Object anObject, int targetSqlType, int scale) throws java.sql.SQLExceptionCalls notImplemented.- Specified by:
setObjectin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setCharacterStream
public void setCharacterStream(int param, java.io.Reader reader, int length) throws java.sql.SQLExceptionCalls notImplemented.- Specified by:
setCharacterStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setAsciiStream
public void setAsciiStream(int param, java.io.InputStream inputStream, int length) throws java.sql.SQLExceptionCalls notImplemented.- Specified by:
setAsciiStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setBinaryStream
public void setBinaryStream(int param, java.io.InputStream inputStream, int length) throws java.sql.SQLExceptionCalls notImplemented.- Specified by:
setBinaryStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setNull
public void setNull(int param, int param1, java.lang.String typeName) throws java.sql.SQLExceptionCalls notImplemented.- Specified by:
setNullin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setUnicodeStream
public void setUnicodeStream(int param, java.io.InputStream inputStream, int length) throws java.sql.SQLExceptionCalls notImplemented.- Specified by:
setUnicodeStreamin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
getMetaData
public java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLExceptionCalls notImplemented. Returns null.- Specified by:
getMetaDatain interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
setTimestamp
public void setTimestamp(int param, java.sql.Timestamp timestamp, java.util.Calendar calendar) throws java.sql.SQLExceptionCalls notImplemented.- Specified by:
setTimestampin interfacejava.sql.PreparedStatement- Throws:
java.sql.SQLException
-
addExpectedExecuteQuery
public void addExpectedExecuteQuery(java.lang.String queryString, java.sql.ResultSet resultSet)
-
addExpectedExecuteUpdate
public void addExpectedExecuteUpdate(java.lang.String queryString, int updateCount)
-
addExpectedExecute
public void addExpectedExecute(java.lang.String queryString, boolean success)
-
setExpectedCloseCalls
public void setExpectedCloseCalls(int callCount)
-
setupConnection
public void setupConnection(java.sql.Connection conn)
-
setupThrowExceptionOnExecute
public void setupThrowExceptionOnExecute(java.sql.SQLException exception)
-
setupUpdateCount
public void setupUpdateCount(int updateCount)
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
execute
public boolean execute(java.lang.String sql) throws java.sql.SQLException- Specified by:
executein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeQuery
public java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException- Specified by:
executeQueryin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException- Specified by:
executeUpdatein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getMaxFieldSize
public int getMaxFieldSize() throws java.sql.SQLException- Specified by:
getMaxFieldSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws java.sql.SQLException- Specified by:
setMaxFieldSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getMaxRows
public int getMaxRows() throws java.sql.SQLException- Specified by:
getMaxRowsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setMaxRows
public void setMaxRows(int max) throws java.sql.SQLException- Specified by:
setMaxRowsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws java.sql.SQLException- Specified by:
setEscapeProcessingin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getQueryTimeout
public int getQueryTimeout() throws java.sql.SQLException- Specified by:
getQueryTimeoutin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws java.sql.SQLException- Specified by:
setQueryTimeoutin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
cancel
public void cancel() throws java.sql.SQLException- Specified by:
cancelin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException- Specified by:
getWarningsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException- Specified by:
clearWarningsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setCursorName
public void setCursorName(java.lang.String name) throws java.sql.SQLException- Specified by:
setCursorNamein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException- Specified by:
getResultSetin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getUpdateCount
public int getUpdateCount() throws java.sql.SQLException- Specified by:
getUpdateCountin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getMoreResults
public boolean getMoreResults() throws java.sql.SQLException- Specified by:
getMoreResultsin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setFetchDirection
public void setFetchDirection(int direction) throws java.sql.SQLException- Specified by:
setFetchDirectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getFetchDirection
public int getFetchDirection() throws java.sql.SQLException- Specified by:
getFetchDirectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
setFetchSize
public void setFetchSize(int rows) throws java.sql.SQLException- Specified by:
setFetchSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getFetchSize
public int getFetchSize() throws java.sql.SQLException- Specified by:
getFetchSizein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getResultSetConcurrency
public int getResultSetConcurrency() throws java.sql.SQLException- Specified by:
getResultSetConcurrencyin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getResultSetType
public int getResultSetType() throws java.sql.SQLException- Specified by:
getResultSetTypein interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
addBatch
public void addBatch(java.lang.String sql) throws java.sql.SQLException- Specified by:
addBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
clearBatch
public void clearBatch() throws java.sql.SQLException- Specified by:
clearBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
executeBatch
public int[] executeBatch() throws java.sql.SQLException- Specified by:
executeBatchin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfacejava.sql.Statement- Throws:
java.sql.SQLException
-
-