|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.sqlunit.test.mock.MockResultSetUtils
public final class MockResultSetUtils
Collection of utility methods to manipulate MockResultSets.
Method Summary | |
---|---|
static com.mockrunner.mock.jdbc.MockResultSetMetaData |
buildMetaData(ColumnMetaData[] cols)
Convenience method to build a ResultSetMetaData object using data passed in through the array of ColumnMetaData objects. |
static com.mockrunner.mock.jdbc.MockResultSet |
buildScalarOutParam(java.lang.String value)
Convenience method to build a scalar out parameter as a resultset. |
static com.mockrunner.mock.jdbc.MockResultSet |
buildSQLExceptionResultSet(int sqlCode,
java.lang.String message)
Convenience method for creating a ResultSet object with an embedded SQLException. |
static com.mockrunner.mock.jdbc.MockResultSet |
buildZerothResultSet(int numResultSets)
Convenience method to return the zero-th result set. |
static com.mockrunner.mock.jdbc.MockResultSet |
buildZerothResultSetWithUpdateCount(int updateCount)
Sets the update count as the second column in the mock resultset for returning number of results (position 0). |
static int |
getNumberOfResultSets(com.mockrunner.mock.jdbc.MockResultSet mrs)
Convenience method to return the number of resultsets available for this query by parsing the MockResultSet returned at index 0. |
static java.lang.Object |
getOutParam(com.mockrunner.mock.jdbc.MockResultSet mrs,
int sqlType)
Convenience method to extract a scalar out parameter from a resultset. |
static java.sql.SQLException |
getSQLExceptionFromResultSet(com.mockrunner.mock.jdbc.MockResultSet mrs)
Convenience method to parse out and return the embedded SQLException object from the specified ResultSet object. |
static int |
getUpdateCount(com.mockrunner.mock.jdbc.MockResultSet mrs)
Parses the update count from the MockResultSet passed in. |
static boolean |
isSQLException(com.mockrunner.mock.jdbc.MockResultSet mrs)
Convenience method to determine if the ResultSet is an Exception resultset. |
static java.lang.String |
replaceParameters(java.lang.String oldString,
java.util.Map parameterMap)
Replaces the positional parameters in a parameterized SQL string with appropriate values from the parameter map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static com.mockrunner.mock.jdbc.MockResultSet buildZerothResultSet(int numResultSets)
numResultSets
- the number of result sets returned by this SQL.
public static int getNumberOfResultSets(com.mockrunner.mock.jdbc.MockResultSet mrs)
mrs
- a MockResultSet object.
public static com.mockrunner.mock.jdbc.MockResultSet buildZerothResultSetWithUpdateCount(int updateCount)
updateCount
- the count of the number of rows updated.
public static int getUpdateCount(com.mockrunner.mock.jdbc.MockResultSet mrs)
mrs
- a MockResultSet object returned from the zeroth position.
public static com.mockrunner.mock.jdbc.MockResultSet buildScalarOutParam(java.lang.String value)
value
- the String value of the parameter.
public static java.lang.Object getOutParam(com.mockrunner.mock.jdbc.MockResultSet mrs, int sqlType)
mrs
- a MockResult object.sqlType
- the SQL type of the object.
public static com.mockrunner.mock.jdbc.MockResultSet buildSQLExceptionResultSet(int sqlCode, java.lang.String message)
sqlCode
- the SQLException sqlCode value.message
- the SQLException message value.
public static boolean isSQLException(com.mockrunner.mock.jdbc.MockResultSet mrs)
mrs
- the MockResultSet object.
public static java.sql.SQLException getSQLExceptionFromResultSet(com.mockrunner.mock.jdbc.MockResultSet mrs)
mrs
- the MockResultSet object.
public static com.mockrunner.mock.jdbc.MockResultSetMetaData buildMetaData(ColumnMetaData[] cols)
cols
- an array of ColumnMetaData objects.
public static java.lang.String replaceParameters(java.lang.String oldString, java.util.Map parameterMap)
oldString
- the parameterized SQL string.parameterMap
- a Map of parameters.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |