Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql
In directory usw-pr-cvs1:/tmp/cvs-serv11808/src/jdk/common/com/mockobjects/sql
Modified Files:
CommonMockStatement.java
Log Message:
Patch from Francois Beausoleil <fra...@ya...> to allow
connection to be set
Index: CommonMockStatement.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockStatement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CommonMockStatement.java 28 Jun 2002 17:35:39 -0000 1.1
+++ CommonMockStatement.java 8 Jul 2002 18:30:37 -0000 1.2
@@ -16,6 +16,8 @@
private int myUpdateCount = 0;
private SQLException myExecuteException = null;
+ private Connection myConnection = null;
+
public void setExpectedExecuteCalls(int callCount) {
myExecuteCalls.setExpected(callCount);
}
@@ -32,6 +34,10 @@
myResultSets.addObjectToReturn(aResultSet);
}
+ public void setupConnection(Connection conn) {
+ myConnection = conn;
+ }
+
public void setupThrowExceptionOnExecute(SQLException exception) {
myExecuteException = exception;
}
@@ -42,7 +48,7 @@
protected void innerExecute() throws SQLException {
myExecuteCalls.inc();
- if(null != myExecuteException) {
+ if (null != myExecuteException) {
throw myExecuteException;
}
}
@@ -59,7 +65,7 @@
public ResultSet executeQuery(String sql) throws SQLException {
myQueryString.setActual(sql);
innerExecute();
- return (ResultSet) myResultSets.nextReturnObject();
+ return (ResultSet)myResultSets.nextReturnObject();
}
public int executeUpdate(String sql) throws SQLException {
@@ -172,8 +178,6 @@
}
public Connection getConnection() throws SQLException {
- notImplemented();
- return null;
+ return myConnection;
}
-
}
|