db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r505700 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/PreparedStatement.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BatchUpdateTest.java
Date Sat, 10 Feb 2007 14:48:07 GMT
Author: myrnavl
Date: Sat Feb 10 06:48:06 2007
New Revision: 505700

URL: http://svn.apache.org/viewvc?view=rev&rev=505700
Log:
DERBY-2112 - fix NPE on executeBatchRequestX when PreparedStatement has no parameters. 
  Fix suggested by reporter, Cesar Devera.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BatchUpdateTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java?view=diff&rev=505700&r1=505699&r2=505700
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java Sat
Feb 10 06:48:06 2007
@@ -2261,9 +2261,11 @@
         }
 
         for (int i = 0; i < batchSize; i++) {
-            parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
-            parameters_ = (Object[]) batch_.get(i);
-
+            if (parameterMetaData_ != null) {
+                parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
+                parameters_ = (Object[]) batch_.get(i);
+            }
+            
             if (sqlMode_ != isCall__) {
                 boolean outputExpected;
                 try {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BatchUpdateTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BatchUpdateTest.java?view=diff&rev=505700&r1=505699&r2=505700
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BatchUpdateTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BatchUpdateTest.java
Sat Feb 10 06:48:06 2007
@@ -92,7 +92,6 @@
  *      try executing a batch which nothing in it.
  *    - testNoParametersPreparedBatch()
  *      try executing a batch with no parameters. 
- *      (fails with NullPointerException with NetworkServer. See DERBY-2112
  *    - testSingleValueSetPreparedBatch()
  *      try executing a batch which one parameter set in it.
  *    - testMultipleValueSetPreparedBatch()
@@ -1017,14 +1016,10 @@
         commit();
     }
     
-    // try prepared statement batch with just no settable parameters.
+    // try prepared statement batch without settable parameters.
     public void testNoParametersPreparedBatch() throws SQLException {
 
-        // TODO: analyze & implement for NetworkServer when DERBY-2112 is fixed
-        // test fails with NullPointerException with NetworkServer
-        // see DERBY-2112
-        if (!usingEmbedded())
-            return;
+        // Note: also tests for fix of NPE of DERBY-2112
      
         Statement stmt = createStatement();
         ResultSet rs;
@@ -1649,4 +1644,4 @@
         conn2.rollback();
         commit();
     }
-}
\ No newline at end of file
+}



Mime
View raw message