|
|||||||||
| Home >> All >> com >> mockobjects >> [ sql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.mockobjects.sql
Class CommonMockStatement

java.lang.Objectcom.mockobjects.MockObject
com.mockobjects.sql.CommonMockStatement
- All Implemented Interfaces:
- java.sql.Statement, com.mockobjects.Verifiable
- Direct Known Subclasses:
- CommonMockPreparedStatement, MockStatement
- abstract class CommonMockStatement
- extends com.mockobjects.MockObject
- implements java.sql.Statement
- extends com.mockobjects.MockObject
- Version:
- $Revision: 1.4 $
| Field Summary | |
private com.mockobjects.ReturnObjectBag |
executeQueryResults
|
private com.mockobjects.ReturnObjectBag |
executeResults
|
private com.mockobjects.ReturnObjectBag |
executeUpdateResults
|
protected com.mockobjects.ExpectationCounter |
myCloseCalls
|
private java.sql.Connection |
myConnection
|
private java.sql.SQLException |
myExecuteException
|
private int |
myUpdateCount
|
| 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 | |
(package private) |
CommonMockStatement()
|
| Method Summary | |
void |
addBatch(java.lang.String sql)
This method adds a SQL statement to a SQL batch. |
void |
addExpectedExecute(java.lang.String queryString,
boolean success)
|
void |
addExpectedExecuteQuery(java.lang.String queryString,
java.sql.ResultSet resultSet)
|
void |
addExpectedExecuteUpdate(java.lang.String queryString,
int updateCount)
|
void |
cancel()
This method cancels an outstanding statement, if the database supports that operation. |
void |
clearBatch()
This method clears out any SQL statements that have been populated in the current batch. |
void |
clearWarnings()
This method clears any SQL warnings that have been attached to this statement. |
void |
close()
This method closes the statement and frees any associated resources. |
boolean |
execute(java.lang.String sql)
This method executes an arbitrary SQL statement of any time. |
int[] |
executeBatch()
This method executes the SQL batch and returns an array of update counts - one for each SQL statement in the batch - ordered in the same order the statements were added to the batch. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
This method executes the specified SQL SELECT statement and returns a (possibly empty) ResultSet with the results of the query. |
int |
executeUpdate(java.lang.String sql)
This method executes the specified SQL INSERT, UPDATE, or DELETE statement and returns the number of rows affected, which may be 0. |
java.sql.Connection |
getConnection()
This method returns the Connection instance that was
used to create this object. |
int |
getFetchDirection()
This method returns the current direction that the driver thinks the result set will be accessed int. |
int |
getFetchSize()
This method returns the number of rows the driver believes should be fetched from the database at a time. |
int |
getMaxFieldSize()
This method returns the maximum length of any column value in bytes. |
int |
getMaxRows()
This method returns the maximum possible number of rows in a result set. |
boolean |
getMoreResults()
This method advances the result set pointer to the next result set, which can then be retrieved using getResultSet |
int |
getQueryTimeout()
The method returns the number of seconds a statement may be in process before timing out. |
java.sql.ResultSet |
getResultSet()
This method returns the result set of the SQL statement that was executed. |
int |
getResultSetConcurrency()
This method returns the concurrency type of the result set for this statement. |
int |
getResultSetType()
This method returns the result set type for this statement. |
int |
getUpdateCount()
This method returns the update count of the SQL statement that was executed. |
java.sql.SQLWarning |
getWarnings()
This method returns the first SQL warning attached to this statement. |
protected void |
innerExecute()
|
void |
setCursorName(java.lang.String name)
This method sets the cursor name that will be used by the result set. |
void |
setEscapeProcessing(boolean enable)
This method sets the local escape processing mode on or off. |
void |
setExpectedCloseCalls(int callCount)
|
void |
setFetchDirection(int direction)
This method informs the driver which direction the result set will be accessed in. |
void |
setFetchSize(int rows)
This method informs the driver how many rows it should fetch from the database at a time. |
void |
setMaxFieldSize(int max)
This method sets the limit for the maximum length of any column in bytes. |
void |
setMaxRows(int max)
This method sets the maximum number of rows that can be present in a result set. |
void |
setQueryTimeout(int seconds)
This method sets the number of seconds a statement may be in process before timing out. |
void |
setupConnection(java.sql.Connection conn)
|
void |
setupThrowExceptionOnExecute(java.sql.SQLException exception)
|
void |
setupUpdateCount(int updateCount)
|
| Methods inherited from class com.mockobjects.MockObject |
assertEquals, assertEquals, assertTrue, fail, notImplemented, notYetImplemented, notYetImplemented, verify |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.sql.Statement |
execute, execute, execute, executeUpdate, executeUpdate, executeUpdate, getGeneratedKeys, getMoreResults, getResultSetHoldability |
| Field Detail |
myCloseCalls
protected final com.mockobjects.ExpectationCounter myCloseCalls
executeQueryResults
private final com.mockobjects.ReturnObjectBag executeQueryResults
executeUpdateResults
private final com.mockobjects.ReturnObjectBag executeUpdateResults
executeResults
private final com.mockobjects.ReturnObjectBag executeResults
myUpdateCount
private int myUpdateCount
myExecuteException
private java.sql.SQLException myExecuteException
myConnection
private java.sql.Connection myConnection
| Constructor Detail |
CommonMockStatement
CommonMockStatement()
| Method Detail |
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)
innerExecute
protected void innerExecute()
throws java.sql.SQLException
close
public void close()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method closes the statement and frees any associated resources.
- Specified by:
closein interfacejava.sql.Statement
execute
public boolean execute(java.lang.String sql) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method executes an arbitrary SQL statement of any time. The
methods
getResultSet,getMoreResultsandgetUpdateCountretrieve the results.- Specified by:
executein interfacejava.sql.Statement
executeQuery
public java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method executes the specified SQL SELECT statement and returns a
(possibly empty)
ResultSetwith the results of the query.- Specified by:
executeQueryin interfacejava.sql.Statement
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method executes the specified SQL INSERT, UPDATE, or DELETE statement
and returns the number of rows affected, which may be 0.
- Specified by:
executeUpdatein interfacejava.sql.Statement
getMaxFieldSize
public int getMaxFieldSize()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the maximum length of any column value in bytes.
- Specified by:
getMaxFieldSizein interfacejava.sql.Statement
setMaxFieldSize
public void setMaxFieldSize(int max)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method sets the limit for the maximum length of any column in bytes.
- Specified by:
setMaxFieldSizein interfacejava.sql.Statement
getMaxRows
public int getMaxRows()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the maximum possible number of rows in a result set.
- Specified by:
getMaxRowsin interfacejava.sql.Statement
setMaxRows
public void setMaxRows(int max)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method sets the maximum number of rows that can be present in a
result set.
- Specified by:
setMaxRowsin interfacejava.sql.Statement
setEscapeProcessing
public void setEscapeProcessing(boolean enable)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method sets the local escape processing mode on or off. The
default value is on.
- Specified by:
setEscapeProcessingin interfacejava.sql.Statement
getQueryTimeout
public int getQueryTimeout()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - The method returns the number of seconds a statement may be in process
before timing out. A value of 0 means there is no timeout.
- Specified by:
getQueryTimeoutin interfacejava.sql.Statement
setQueryTimeout
public void setQueryTimeout(int seconds)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method sets the number of seconds a statement may be in process
before timing out. A value of 0 means there is no timeout.
- Specified by:
setQueryTimeoutin interfacejava.sql.Statement
cancel
public void cancel()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method cancels an outstanding statement, if the database supports
that operation.
- Specified by:
cancelin interfacejava.sql.Statement
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the first SQL warning attached to this statement.
Subsequent warnings will be chained to this one.
- Specified by:
getWarningsin interfacejava.sql.Statement
clearWarnings
public void clearWarnings()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method clears any SQL warnings that have been attached to this
statement.
- Specified by:
clearWarningsin interfacejava.sql.Statement
setCursorName
public void setCursorName(java.lang.String name) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method sets the cursor name that will be used by the result set.
- Specified by:
setCursorNamein interfacejava.sql.Statement
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the result set of the SQL statement that was
executed. This should be called only once per result set returned.
- Specified by:
getResultSetin interfacejava.sql.Statement
getUpdateCount
public int getUpdateCount()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the update count of the SQL statement that was
executed. This should be called only once per executed SQL statement.
- Specified by:
getUpdateCountin interfacejava.sql.Statement
getMoreResults
public boolean getMoreResults()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method advances the result set pointer to the next result set,
which can then be retrieved using
getResultSet- Specified by:
getMoreResultsin interfacejava.sql.Statement
setFetchDirection
public void setFetchDirection(int direction)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method informs the driver which direction the result set will
be accessed in.
- Specified by:
setFetchDirectionin interfacejava.sql.Statement
getFetchDirection
public int getFetchDirection()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the current direction that the driver thinks the
result set will be accessed int.
- Specified by:
getFetchDirectionin interfacejava.sql.Statement
setFetchSize
public void setFetchSize(int rows)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method informs the driver how many rows it should fetch from the
database at a time.
- Specified by:
setFetchSizein interfacejava.sql.Statement
getFetchSize
public int getFetchSize()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the number of rows the driver believes should be
fetched from the database at a time.
- Specified by:
getFetchSizein interfacejava.sql.Statement
getResultSetConcurrency
public int getResultSetConcurrency()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the concurrency type of the result set for this
statement. This will be one of the concurrency types defined in
ResultSet.- Specified by:
getResultSetConcurrencyin interfacejava.sql.Statement
getResultSetType
public int getResultSetType()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the result set type for this statement. This will
be one of the result set types defined in
ResultSet.- Specified by:
getResultSetTypein interfacejava.sql.Statement
addBatch
public void addBatch(java.lang.String sql) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method adds a SQL statement to a SQL batch. A driver is not
required to implement this method.
- Specified by:
addBatchin interfacejava.sql.Statement
clearBatch
public void clearBatch()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method clears out any SQL statements that have been populated in
the current batch. A driver is not required to implement this method.
- Specified by:
clearBatchin interfacejava.sql.Statement
executeBatch
public int[] executeBatch()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method executes the SQL batch and returns an array of update
counts - one for each SQL statement in the batch - ordered in the same
order the statements were added to the batch. A driver is not required
to implement this method.
- Specified by:
executeBatchin interfacejava.sql.Statement
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the
Connectioninstance that was used to create this object.- Specified by:
getConnectionin interfacejava.sql.Statement
|
|||||||||
| Home >> All >> com >> mockobjects >> [ sql overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC