提交 5ff0818d authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 783321d4
......@@ -145,31 +145,6 @@ java org.h2.test.TestAll timer
/*
Thanks for the response. Yes I'm doing embedded so this is fine for
me. One other question, I have noticed that once I cancel my
PreparedStatement, it does not seem to work again. I couldn't find a
way to clear it, so I guess I have to re-instantiate it?
Also, how promptly should this cancel take effect? It seemed to be
fairly delayed, but there's still a chance my implementation wasn't
correct.
Hi,
You are right, a PreparedStatement could not be reused after cancel was called.
I have fixed this and added a test case. Thanks for reporting this!
Delayed cancel: if you use the database in embedded mode, it depends on thread
scheduling when the statement is cancelled (you need two threads). I also got
this problem. What I did is use Thread.yield in my test, like this:
CREATE ALIAS YIELD FOR "java.lang.Thread.yield";
SELECT YIELD() FROM ...
So for each row, Thread.yield() is called, letting other threads do some work.
Another solution would be to use SET THROTTLE (see docs).
Thomas
web page translation
TestMultiThreadedKernel and integrate in unit tests; use also in-memory and so on
......
......@@ -27,7 +27,7 @@ public class TestLinkedTable extends TestBase {
private void testLinkTwoTables() throws Exception {
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:mem:one", "linkuser", "linkpass");
Connection conn = DriverManager.getConnection("jdbc:h2:mem:one", "sa", "sa");
Statement stat = conn.createStatement();
stat.execute("CREATE SCHEMA Y");
stat.execute("CREATE TABLE A( C INT)");
......@@ -36,8 +36,8 @@ public class TestLinkedTable extends TestBase {
stat.execute("INSERT INTO Y.A VALUES(2)");
Connection conn2 = DriverManager.getConnection("jdbc:h2:mem:two");
Statement stat2 = conn2.createStatement();
stat2.execute("CREATE LINKED TABLE one('org.h2.Driver', 'jdbc:h2:mem:one', 'linkuser', 'linkpass', 'Y.A');");
stat2.execute("CREATE LINKED TABLE two('org.h2.Driver', 'jdbc:h2:mem:one', 'linkuser', 'linkpass', 'A');");
stat2.execute("CREATE LINKED TABLE one('org.h2.Driver', 'jdbc:h2:mem:one', 'sa', 'sa', 'Y.A');");
stat2.execute("CREATE LINKED TABLE two('org.h2.Driver', 'jdbc:h2:mem:one', 'sa', 'sa', 'A');");
ResultSet rs = stat2.executeQuery("SELECT * FROM one");
rs.next();
check(rs.getInt(1), 2);
......
......@@ -101,17 +101,21 @@ public class TestLob extends TestBase {
try {
conn.createStatement().execute("DELETE FROM TEST");
conn.commit();
// DELETE does now fail in all systems (Linux), but in some
// DELETE does not fail in Linux, but in Windows
// error("Error expected");
// but reading afterwards should fail
int len = 0;
while (true) {
int x = in.read();
if (x < 0) {
break;
}
len++;
}
in.close();
error("Error expected");
if (len > 0) {
error("Error expected; len=" + len);
}
} catch (SQLException e) {
checkNotGeneralException(e);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论