db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r630036 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
Date Thu, 21 Feb 2008 22:43:58 GMT
Author: kmarsden
Date: Thu Feb 21 14:43:56 2008
New Revision: 630036

URL: http://svn.apache.org/viewvc?rev=630036&view=rev
Log:
DERBY-3243 (jdbc net client) exception during normal iteration through "ResultSet" of "select
* from t"

Add test retrieving more than 32K lobs. 


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java?rev=630036&r1=630035&r2=630036&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
Thu Feb 21 14:43:56 2008
@@ -3341,6 +3341,52 @@
     }
 
 
+    /**
+     * DERBY-3243 Fix ArrayIndexOutOfBounds Exception
+     * if we retrieve more than 32K lobs
+     * 
+     */
+    public void testRetrieveMoreThan32KLobs() throws SQLException
+    {
+        int numRows = 34000;
+        // Load the database
+        Connection conn = getConnection();
+        conn.setAutoCommit(false);
+        Statement s = createStatement();
+        
+        PreparedStatement ps = prepareStatement("INSERT INTO TESTCLOB VALUES(?,?,?)");
+        for (int i = 0 ; i < numRows;i++)
+        {
+            ps.setInt(1,i);
+            ps.setInt(2,i);
+            ps.setString(3,"" + i);
+            ps.executeUpdate();
+            if (i % 1000 == 0) {
+                commit();
+            }
+        }
+        commit();
+        
+        // retrieve the data
+        
+        ResultSet rs = s.executeQuery("SELECT * from TESTCLOB");
+        while (rs.next()) {
+            rs.getInt(1);
+            Clob c = rs.getClob(3);
+            c.getSubString(1,100);
+        }
+        rs.close();
+        
+        conn.commit();
+        
+        
+    }
+
+
+
+
+        
+    
     private static final String BLOB_BAD_POSITION = "XJ070";
     private static final String BLOB_NONPOSITIVE_LENGTH = "XJ071";
     private static final String BLOB_POSITION_TOO_LARGE = "XJ076";



Mime
View raw message