提交 430e6959 authored 作者: christian.peter.io's avatar christian.peter.io

An IndexOutOfBoundsException could occur in the page store (eg. on "delete from table"). Fixed.

上级 14b1be3c
......@@ -25,6 +25,7 @@ Change Log
The exception contained the text "parent not found" (version 1.2.129) or
"Table not found" (version 1.2.130).
</li><li>After the database was closed, a null pointer exception could occur in Database.flush.
</li><li>An IndexOutOfBoundsException could occur in the page store (eg. on "delete from table"). Fixed.
</li></ul>
<h2>Version 1.2.130 (2010-02-26)</h2>
......
......@@ -230,10 +230,10 @@ public class Data {
* @param len the new length
*/
public void fill(int len) {
if (pos > len) {
pos = len;
}
pos = len;
if (data.length < len) {
checkCapacity(len - data.length);
}
}
/**
......
......@@ -35,6 +35,7 @@ public class TestCases extends TestBase {
}
public void test() throws Exception {
testDeleteIndexOutOfBounds();
testOrderByWithSubselect();
testInsertDeleteRollback();
testLargeRollback();
......@@ -75,6 +76,20 @@ public class TestCases extends TestBase {
testCollation();
deleteDb("cases");
}
private void testDeleteIndexOutOfBounds() throws SQLException {
deleteDb("cases");
Connection conn = getConnection("cases");
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE IF NOT EXISTS test (rowid INTEGER PRIMARY KEY AUTO_INCREMENT, txt VARCHAR(64000));");
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 3000; i++) {
builder.append("abc");
stat.execute("insert into test (txt) values ('" + builder.toString() + "');");
}
stat.execute("DELETE FROM test;");
conn.close();
}
private void testInsertDeleteRollback() throws SQLException {
deleteDb("cases");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论