db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r416696 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/PreparedStatement.java client/org/apache/derby/client/am/Statement.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
Date Fri, 23 Jun 2006 12:19:52 GMT
Author: kahatlen
Date: Fri Jun 23 05:19:51 2006
New Revision: 416696

URL: http://svn.apache.org/viewvc?rev=416696&view=rev
Log:
DERBY-1314: Differences between client and embedded when invoking
stored procedures using Statement.executeUpdate()

Make executeUpdate() return 0 on the client when executing a stored
procedure.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.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?rev=416696&r1=416695&r2=416696&view=diff
==============================================================================
--- 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 Fri
Jun 23 05:19:51 2006
@@ -386,13 +386,9 @@
         }
     }
 
-    // also used by Blob
-    int executeUpdateX() throws SqlException {
+    private int executeUpdateX() throws SqlException {
         flowExecute(executeUpdateMethod__);
-
-        if (sqlMode_ == isUpdate__) {
-            super.checkExecuteUpdatePostConditions("java.sql.PreparedStatement");
-        }
+        checkExecuteUpdatePostConditions("java.sql.PreparedStatement");
         return updateCount_;
     }
 
@@ -1797,6 +1793,12 @@
                 if (connection_.autoCommit_ && resultSet_ == null && resultSetList_
== null && isAutoCommittableStatement_) {
                     connection_.flowAutoCommit();
                 }
+            }
+
+            // The JDBC spec says that executeUpdate() should return 0
+            // when no row count is returned.
+            if (executeType == executeUpdateMethod__ && updateCount_ < 0) {
+                updateCount_ = 0;
             }
 
             // Throw an exception if holdability returned by the server is different from
requested.

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java?rev=416696&r1=416695&r2=416696&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java Fri Jun 23 05:19:51
2006
@@ -2084,6 +2084,12 @@
                 connection_.flowAutoCommit();
             }
         }
+
+        // The JDBC spec says that executeUpdate() should return 0
+        // when no row count is returned.
+        if (executeType == executeUpdateMethod__ && updateCount_ < 0) {
+            updateCount_ = 0;
+        }
     }
 
     void flowExecuteBatch(int[] updateCounts) throws SqlException, BatchUpdateException {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java?rev=416696&r1=416695&r2=416696&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
Fri Jun 23 05:19:51 2006
@@ -102,7 +102,7 @@
      * Tests that <code>Statement.executeUpdate()</code> succeeds when
      * no result sets are returned.
      *
-     * <p>Currently, this test fails with the client driver and JCC.
+     * <p>Currently, this test fails with JCC.
      *
      * @exception SQLException if a database error occurs
      */
@@ -194,7 +194,7 @@
      * Tests that <code>PreparedStatement.executeUpdate()</code>
      * succeeds when no result sets are returned.
      *
-     * <p>Currently, this test fails with the client driver and JCC.
+     * <p>Currently, this test fails with JCC.
      *
      * @exception SQLException if a database error occurs
      */
@@ -213,7 +213,7 @@
      * Tests that <code>PreparedStatement.executeUpdate()</code> fails
      * when a result set is returned from a stored procedure.
      *
-     * <p>Currently, this test fails with the client driver and
+     * <p>Currently, this test fails with
      * JCC. However, the corresponding tests for
      * <code>Statement</code> and <code>CallableStatement</code>
      * succeed. Strange...
@@ -296,7 +296,7 @@
      * Tests that <code>CallableStatement.executeUpdate()</code>
      * succeeds when no result sets are returned.
      *
-     * <p>Currently, this test fails with the client driver and JCC.
+     * <p>Currently, this test fails with JCC.
      *
      * @exception SQLException if a database error occurs
      */
@@ -579,7 +579,7 @@
      */
     public static Test suite() {
         TestSuite suite = new TestSuite(ProcedureTest.class);
-        if (usingEmbedded()) {
+        if (!usingDerbyNet()) {
             suite.addTest
                 (new ProcedureTest
                  ("xtestExecuteUpdateWithNoDynamicResultSets"));
@@ -592,6 +592,8 @@
             suite.addTest
                 (new ProcedureTest
                  ("xtestExecuteUpdateWithNoDynamicResultSets_callable"));
+        }
+        if (usingEmbedded()) {
             suite.addTest
                 (new ProcedureTest
                  ("xtestRollbackStoredProcWhenExecuteQueryReturnsNothing"));



Mime
View raw message