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

--no commit message

--no commit message
上级 131dd96c
......@@ -31,22 +31,26 @@ public class TestOutOfMemory extends TestBase {
deleteDb("outOfMemory");
Connection conn = getConnection("outOfMemory");
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)");
PreparedStatement prep = conn.prepareStatement("update stuff set text = text || ' upd'");
prep.execute();
eatMemory(80);
try {
prep.execute();
fail();
} catch (SQLException e) {
assertEquals(ErrorCode.GENERAL_ERROR_1, e.getErrorCode());
try {
prep.execute();
fail();
} 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) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论