db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r612849 - in /db/derby/code/trunk/java: client/org/apache/derby/client/net/NetCursor.java testing/org/apache/derbyTesting/functionTests/tests/derbynet/PrepareStatementTest.java
Date Thu, 17 Jan 2008 15:52:45 GMT
Author: kmarsden
Date: Thu Jan 17 07:51:40 2008
New Revision: 612849

URL: http://svn.apache.org/viewvc?rev=612849&view=rev
Log:
DERBY-3230 Selecting data from a Table raises Error XN008: Query processing has been terminated
due to an error on the server

The solution was to move the retrieval of all of the data associated with the QRYDTA before
the ResultSet is marked as closed on the server. 

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/PrepareStatementTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java?rev=612849&r1=612848&r2=612849&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetCursor.java Thu Jan 17
07:51:40 2008
@@ -146,7 +146,12 @@
         }
 
         NetSqlca[] netSqlca = this.parseSQLCARD(qrydscTypdef_);
-
+        // If we don't have at least one byte in the buffer for the DA null indicator,
+        // then we need to send a CNTQRY request to fetch the next block of data.
+        // Read the DA null indicator. Do this before we close mark the statement
+        // closed on the server. DERBY-3230
+        daNullIndicator = readFdocaOneByte();
+        
         if (netSqlca != null) {
             for (int i=0;i<netSqlca.length; i++) {
                 int sqlcode = netSqlca[i].getSqlCode();
@@ -183,10 +188,7 @@
         setIsUpdataDeleteHole(rowIndex, receivedDeleteHoleWarning);
         setIsRowUpdated(receivedRowUpdatedWarning);
         
-        // If we don't have at least one byte in the buffer for the DA null indicator,
-        // then we need to send a CNTQRY request to fetch the next block of data.
-        // Read the DA null indicator.
-        daNullIndicator = readFdocaOneByte();
+        
 
         // In the case for held cursors, the +100 comes back as part of the QRYDTA, and as
         // we are parsing through the row that contains the SQLCA with +100, we mark the

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/PrepareStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/PrepareStatementTest.java?rev=612849&r1=612848&r2=612849&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/PrepareStatementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/PrepareStatementTest.java
Thu Jan 17 07:51:40 2008
@@ -1249,6 +1249,41 @@
     }
 
     /**
+     * Test fix for protocol error if splitQRYDTA occurs during DRDAConnThread.doneData()
+     * DERBY-3230
+     * @throws SQLException
+     */
+    public void testDerby3230() throws SQLException {
+        Statement s = createStatement();
+        s.executeUpdate("CREATE TABLE TAB (col1 varchar(32672) NOT NULL)");
+        PreparedStatement ps = prepareStatement("INSERT INTO TAB VALUES(?)");
+        ps.setString(1,makeString(15000));
+        ps.executeUpdate();
+        ps.setString(1,makeString(7500));
+        ps.executeUpdate();
+        ps.setString(1,makeString(5000));
+        ps.executeUpdate();
+        ps.setString(1,makeString(2000));
+        ps.executeUpdate();
+        ps.setString(1,makeString(1600));
+        ps.executeUpdate();
+        ps.setString(1,makeString(800));
+        ps.executeUpdate();
+        ps.setString(1,makeString(400));
+        ps.executeUpdate();
+        ps.setString(1,makeString(200));
+        ps.executeUpdate();
+        ps.setString(1,makeString(100));
+        ps.executeUpdate();
+        ps.setString(1,makeString(56));
+        ps.executeUpdate();
+            
+        ResultSet rs = s.executeQuery("SELECT * from tab");
+        // drain the resultset
+        JDBC.assertDrainResults(rs);
+                   
+    }
+    /**
      * Return a string of the given length.  The string will contain just 'X'
      * characters.
      *



Mime
View raw message