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 ka...@apache.org on 2010/04/06 20:17:45 UTC
svn commit: r931255 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc:
CoveredIdxScan.java HeapScan.java
Author: kahatlen
Date: Tue Apr 6 18:17:45 2010
New Revision: 931255
URL: http://svn.apache.org/viewvc?rev=931255&view=rev
Log:
DERBY-4607: HeapScan test commits wrong connection
Use BaseJDBCTestCase helper methods to ensure that the same connection
is used all places in the HeapScan and in its sub-class
CoveredIdxScan. (Previously, different connections were used when
executing a statement and when committing.)
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/CoveredIdxScan.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/HeapScan.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/CoveredIdxScan.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/CoveredIdxScan.java?rev=931255&r1=931254&r2=931255&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/CoveredIdxScan.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/CoveredIdxScan.java Tue Apr 6 18:17:45 2010
@@ -63,7 +63,7 @@ public class CoveredIdxScan extends Heap
*/
public void setUp() throws Exception {
- select = openDefaultConnection().prepareStatement("SELECT i1 FROM "+tableName +
+ select = prepareStatement("SELECT i1 FROM " + tableName +
" WHERE i1 > ? and i1 <= ?");
}
@@ -102,8 +102,8 @@ public class CoveredIdxScan extends Heap
actualCount++;
}
assertEquals(rowcount,actualCount);
- getConnection().commit();
rs.close();
+ commit();
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/HeapScan.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/HeapScan.java?rev=931255&r1=931254&r2=931255&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/HeapScan.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/perf/basic/jdbc/HeapScan.java Tue Apr 6 18:17:45 2010
@@ -103,7 +103,7 @@ public class HeapScan extends JDBCPerfTe
*/
public void setUp() throws Exception {
- select = openDefaultConnection().prepareStatement("SELECT * FROM "+tableName);
+ select = prepareStatement("SELECT * FROM " + tableName);
// Create a SELECT statement that uses predicates. Also initialize
// the predicates with some data of the correct type for this test
@@ -147,7 +147,7 @@ public class HeapScan extends JDBCPerfTe
assertEquals(actualCount,rowcount);
rs.close();
- getConnection().commit();
+ commit();
}
@@ -177,8 +177,8 @@ public class HeapScan extends JDBCPerfTe
actualCount++;
}
assertEquals(actualCount,rowcount);
- getConnection().commit();
rs.close();
+ commit();
}
/**
@@ -197,10 +197,11 @@ public class HeapScan extends JDBCPerfTe
* Cleanup - close resources opened in this test.
**/
public void tearDown() throws Exception {
-
- select.close();
+ // The statements will be closed by BaseJDBCTestCase.tearDown(), but
+ // we need to set the fields to null to allow them to be garbage
+ // collected.
select = null;
- selectWithPred = null; // will be closed in super.tearDown()
+ selectWithPred = null;
super.tearDown();
}
}