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

--no commit message

--no commit message
上级 131dd96c
...@@ -31,22 +31,26 @@ public class TestOutOfMemory extends TestBase { ...@@ -31,22 +31,26 @@ public class TestOutOfMemory extends TestBase {
deleteDb("outOfMemory"); deleteDb("outOfMemory");
Connection conn = getConnection("outOfMemory"); Connection conn = getConnection("outOfMemory");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table stuff (id int primary key, text varchar as space(100) || id)"); stat.execute("drop all objects");
stat.execute("create table stuff (id int, text varchar as space(100) || id)");
stat.execute("insert into stuff(id) select x from system_range(1, 2000)"); stat.execute("insert into stuff(id) select x from system_range(1, 2000)");
PreparedStatement prep = conn.prepareStatement("update stuff set text = text || ' upd'"); PreparedStatement prep = conn.prepareStatement("update stuff set text = text || ' upd'");
prep.execute(); prep.execute();
eatMemory(80); eatMemory(80);
try { try {
prep.execute(); try {
fail(); prep.execute();
} catch (SQLException e) { fail();
assertEquals(ErrorCode.GENERAL_ERROR_1, e.getErrorCode()); } catch (SQLException e) {
assertEquals(ErrorCode.GENERAL_ERROR_1, e.getErrorCode());
}
list = null;
ResultSet rs = stat.executeQuery("select count(*) from stuff");
rs.next();
assertEquals(2000, rs.getInt(1));
} finally {
conn.close();
} }
list = null;
ResultSet rs = stat.executeQuery("select count(*) from stuff");
rs.next();
assertEquals(2000, rs.getInt(1));
conn.close();
} }
private void eatMemory(int remainingKB) { private void eatMemory(int remainingKB) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论