db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1329148 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdatableResultSetTest.java
Date Mon, 23 Apr 2012 09:53:04 GMT
Author: kahatlen
Date: Mon Apr 23 09:53:03 2012
New Revision: 1329148

URL: http://svn.apache.org/viewvc?rev=1329148&view=rev
Log:
DERBY-5701: Make UpdatableResultSetTest less hungry on heap space

Close statements earlier.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdatableResultSetTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdatableResultSetTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdatableResultSetTest.java?rev=1329148&r1=1329147&r2=1329148&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdatableResultSetTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdatableResultSetTest.java
Mon Apr 23 09:53:03 2012
@@ -4039,6 +4039,7 @@ public class UpdatableResultSetTest  ext
             int sqlType,
             int updateXXXName) throws SQLException, UnsupportedEncodingException 
     {
+        Statement s = createStatement();
         ResultSet rs, rs1;
         int checkAgainstColumn = updateXXXName;
         for (int indexOrName = 1; indexOrName <= 2; indexOrName++) {
@@ -4254,8 +4255,7 @@ public class UpdatableResultSetTest  ext
                 }
                 verifyData(sqlType, checkAgainstColumn);
                 
-                createStatement().executeUpdate(
-                        "DELETE FROM AllDataTypesForTestingTable");
+                s.executeUpdate("DELETE FROM AllDataTypesForTestingTable");
                 
             } catch (SQLException se) {
                 if (usingEmbedded()) {
@@ -4275,7 +4275,8 @@ public class UpdatableResultSetTest  ext
             }
             rs.close();
             rs1.close();       
-         }
+        }
+        closeStatement(s);
     }
     
     private void createTableT1() throws SQLException {
@@ -4445,19 +4446,14 @@ public class UpdatableResultSetTest  ext
             assertEquals("FAIL - wrong value on " + allSQLTypes[sqlType - 1] + 
                     " using " + allUpdateXXXNames[updateXXXName - 1], 
                     rs.getBoolean(sqlType), rs1.getBoolean(1));
-            return;
-        }
-        if (updateXXXName == 19) { //verifying updateNull
+        } else if (updateXXXName == 19) { //verifying updateNull
             assertNull("FAIL - wrong value on " + allSQLTypes[sqlType - 1] + 
                     " using " + allUpdateXXXNames[updateXXXName - 1], 
                     rs.getObject(sqlType));
             assertTrue("FAIL - wrong value on " + allSQLTypes[sqlType - 1] + 
                     " using " + allUpdateXXXNames[updateXXXName - 1], 
                     rs.wasNull());
-            return;
-        }
-        
-        if (sqlType == 1) {
+        } else if (sqlType == 1) {
             // verify update made to SMALLINT column with updateXXX methods
             assertEquals("FAIL - wrong value on " + allSQLTypes[sqlType - 1] + 
                     " using " + allUpdateXXXNames[updateXXXName - 1], 
@@ -4557,8 +4553,8 @@ public class UpdatableResultSetTest  ext
         
         rs.close();
         rs1.close();
-        pstmt.close();
-        pstmt1.close();
+        closeStatement(pstmt);
+        closeStatement(pstmt1);
     }
     
     private void resetData() throws SQLException {
@@ -4572,6 +4568,7 @@ public class UpdatableResultSetTest  ext
         insertSQL.append("cast("+SQLData[allSQLTypes.length - 1][0]
                 + " as BLOB(1K)))");
         stmt.executeUpdate(insertSQL.toString());
+        closeStatement(stmt);
     }
 }
 



Mime
View raw message