db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r650786 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ResultSetsFromPreparedStatementTest.java
Date Wed, 23 Apr 2008 08:41:12 GMT
Author: kristwaa
Date: Wed Apr 23 01:41:11 2008
New Revision: 650786

URL: http://svn.apache.org/viewvc?rev=650786&view=rev
Log:
DERBY-3397: Derby 10.3.1.4 and 10.3.2.1 break scrollable result sets? Hibernate Query.setFirstResult
and/or setMaxResults.
Added two simple regression tests.
Patch file: derby-3397-2a-junit_reg_test.diff

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ResultSetsFromPreparedStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ResultSetsFromPreparedStatementTest.java?rev=650786&r1=650785&r2=650786&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ResultSetsFromPreparedStatementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ResultSetsFromPreparedStatementTest.java
Wed Apr 23 01:41:11 2008
@@ -2096,4 +2096,40 @@
     public void testBigintGeneratedAlwaysAsIdentity() throws Exception {
         testGeneratedIdentity("BIGINT","ALWAYS");
     }
+
+    /**
+     * Tests that the {@code maxRows} setting takes effect, data is obtained
+     * from a table select.
+     */
+    public void testSetMaxRowsTable()
+            throws SQLException {
+        createTestTable("emp", ES+","+DNO+")", "emp_data");
+        PreparedStatement ps = prepareStatement("select * from emp_data",
+                ResultSet.TYPE_SCROLL_INSENSITIVE,
+                ResultSet.CONCUR_READ_ONLY);
+        // Just make sure we have enough rows in the result set first.
+        // Execute without explicitly specifying maxRows.
+        assertTrue(JDBC.assertDrainResults(ps.executeQuery()) >= 20);
+
+        // Specify maxRows
+        ps.setMaxRows(5);
+        JDBC.assertDrainResults(ps.executeQuery(), 5);
+        ps.setMaxRows(20);
+        JDBC.assertDrainResults(ps.executeQuery(), 20);
+    }
+
+    /**
+     * Tests that the {@code maxRows} setting takes effect, data is obtained
+     * from a value clause.
+     */
+    public void testSetMaxRowsValues()
+            throws SQLException {
+        PreparedStatement ps = prepareStatement("values 0,1,2,3,4,5,6,7,8,9",
+                ResultSet.TYPE_SCROLL_INSENSITIVE,
+                ResultSet.CONCUR_READ_ONLY);
+        ps.setMaxRows(10);
+        JDBC.assertDrainResults(ps.executeQuery(), 10);
+        ps.setMaxRows(2);
+        JDBC.assertDrainResults(ps.executeQuery(), 2);
+    }
 }



Mime
View raw message