提交 3a290ab8 authored 作者: Thomas Mueller's avatar Thomas Mueller

Statement.getQueryTimeout(): only the first call to this method will query the database.

上级 819782b5
...@@ -692,6 +692,7 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -692,6 +692,7 @@ public class JdbcConnection extends TraceObject implements Connection {
setQueryTimeout = prepareCommand("SET QUERY_TIMEOUT ?", setQueryTimeout); setQueryTimeout = prepareCommand("SET QUERY_TIMEOUT ?", setQueryTimeout);
setQueryTimeout.getParameters().get(0).setValue(ValueInt.get(seconds * 1000), false); setQueryTimeout.getParameters().get(0).setValue(ValueInt.get(seconds * 1000), false);
setQueryTimeout.executeUpdate(); setQueryTimeout.executeUpdate();
queryTimeoutCache = seconds;
} catch (Exception e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
......
...@@ -119,7 +119,8 @@ public class TestCancel extends TestBase { ...@@ -119,7 +119,8 @@ public class TestCancel extends TestBase {
executeQuery("SELECT MAX(RAND()) FROM SYSTEM_RANGE(1, 100000000)"); executeQuery("SELECT MAX(RAND()) FROM SYSTEM_RANGE(1, 100000000)");
stat.setQueryTimeout(0); stat.setQueryTimeout(0);
stat.execute("SET QUERY_TIMEOUT 1100"); stat.execute("SET QUERY_TIMEOUT 1100");
assertEquals(2, stat.getQueryTimeout()); // explicit changes are not detected except, as documented
assertEquals(0, stat.getQueryTimeout());
conn.close(); conn.close();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论