You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/08/17 15:05:25 UTC
svn commit: r432222 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java
Author: djd
Date: Thu Aug 17 06:05:24 2006
New Revision: 432222
URL: http://svn.apache.org/viewvc?rev=432222&view=rev
Log:
DERBY-1555 DERBY-1701 (partial) Add utiltiy methods to BaseJDBCTestCase to get Statements, PreparedStatements against
the default connection for the test.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java?rev=432222&r1=432221&r2=432222&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BaseJDBCTestCase.java Thu Aug 17 06:05:24 2006
@@ -63,7 +63,7 @@
*/
// TEMP NAME - WILL BE getConnection() once all uses of the
// static getConnection() have been converted to openDefaultConnection
- public final Connection getXConnection() throws SQLException
+ public Connection getXConnection() throws SQLException
{
if (conn != null)
{
@@ -74,6 +74,59 @@
return conn = getTestConfiguration().openDefaultConnection();
}
+ /**
+ * Utility method to create a Statement using the connection
+ * returned by getConnection.
+ * @return Statement object from getConnection.createStatement()
+ * @throws SQLException
+ */
+ public Statement createStatement() throws SQLException
+ {
+ return getXConnection().createStatement();
+ }
+
+ /**
+ * Utility method to create a Statement using the connection
+ * returned by getConnection.
+ * @return Statement object from
+ * getConnection.createStatement(resultSetType, resultSetConcurrency)
+ * @throws SQLException
+ */
+ public Statement createStatement(int resultSetType,
+ int resultSetConcurrency) throws SQLException
+ {
+ return getXConnection().createStatement(resultSetType, resultSetConcurrency);
+ }
+ /**
+ * Utility method to create a PreparedStatement using the connection
+ * returned by getConnection.
+ * @return Statement object from
+ * getConnection.createStatement(resultSetType, resultSetConcurrency)
+ * @throws SQLException
+ */
+ public PreparedStatement prepareStatement(String sql) throws SQLException
+ {
+ return getXConnection().prepareStatement(sql);
+ }
+
+ /**
+ * Utility method to commit using the connection
+ * returned by getConnection.
+ * @throws SQLException
+ */
+ public void commit() throws SQLException
+ {
+ getXConnection().commit();
+ }
+ /**
+ * Utility method to rollback using the connection
+ * returned by getConnection.
+ * @throws SQLException
+ */
+ public void rollback() throws SQLException
+ {
+ getXConnection().rollback();
+ }
/**
* Tear down this fixture, sub-classes should call
* super.tearDown(). This cleanups & closes the connection