提交 deb7a855 authored 作者: Thomas Mueller's avatar Thomas Mueller

ResultSet.absolute did not always work with large result sets.

上级 694a31cb
...@@ -138,6 +138,7 @@ class ResultDiskBuffer implements ResultExternal { ...@@ -138,6 +138,7 @@ class ResultDiskBuffer implements ResultExternal {
} }
} else { } else {
mainTape.pos = FileStore.HEADER_LENGTH; mainTape.pos = FileStore.HEADER_LENGTH;
mainTape.buffer = new ObjectArray();
} }
} }
......
...@@ -42,6 +42,7 @@ public class TestResultSet extends TestBase { ...@@ -42,6 +42,7 @@ public class TestResultSet extends TestBase {
stat = conn.createStatement(); stat = conn.createStatement();
testAbsolute();
testFetchSize(); testFetchSize();
testOwnUpdates(); testOwnUpdates();
testFindColumn(); testFindColumn();
...@@ -69,6 +70,20 @@ public class TestResultSet extends TestBase { ...@@ -69,6 +70,20 @@ public class TestResultSet extends TestBase {
} }
private void testAbsolute() throws Exception {
// stat.execute("SET MAX_MEMORY_ROWS 90");
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY)");
// there was a problem when more than MAX_MEMORY_ROWS where in the result set
stat.execute("INSERT INTO TEST SELECT X FROM SYSTEM_RANGE(1, 200)");
Statement s2 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = s2.executeQuery("SELECT * FROM TEST ORDER BY ID");
for (int i = 100; i > 0; i--) {
rs.absolute(i);
assertEquals(i, rs.getInt(1));
}
stat.execute("DROP TABLE TEST");
}
private void testFetchSize() throws Exception { private void testFetchSize() throws Exception {
if (!config.networked || config.memory) { if (!config.networked || config.memory) {
return; return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论