Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b1edabaa
提交
b1edabaa
authored
8月 20, 2012
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Statement.getQueryTimeout(): only the first call to this method will query the database.
上级
74b86ad8
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
29 行增加
和
18 行删除
+29
-18
changelog.html
h2/src/docsrc/html/changelog.html
+5
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+15
-11
JdbcStatement.java
h2/src/main/org/h2/jdbc/JdbcStatement.java
+9
-6
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
b1edabaa
...
...
@@ -18,7 +18,11 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Issue 416: PreparedStatement.setNString throws AbstractMethodError.
<ul><li>
Statement.getQueryTimeout(): only the first call to this method will query the database.
If the query timeout was changed in another way than calling setQueryTimeout,
this method will always return the last value. This was changed because Hibernate
calls getQueryTimeout() a lot.
</li><li>
Issue 416: PreparedStatement.setNString throws AbstractMethodError.
All implemented JDBC 4 methods that don't break compatiblity with Java 5
are now included in the default jar file.
</li><li>
Issue 414: for some functions, the parameters were evaluated twice
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
b1edabaa
...
...
@@ -84,6 +84,7 @@ public class JdbcConnection extends TraceObject implements Connection {
private
Statement
executingStatement
;
private
CompareMode
compareMode
=
CompareMode
.
getInstance
(
null
,
0
);
private
CloseWatcher
watcher
;
private
int
queryTimeoutCache
=
-
1
;
/**
* INTERNAL
...
...
@@ -702,18 +703,21 @@ public class JdbcConnection extends TraceObject implements Connection {
public
int
getQueryTimeout
()
throws
SQLException
{
try
{
debugCodeCall
(
"getQueryTimeout"
);
checkClosed
();
getQueryTimeout
=
prepareCommand
(
"SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME=?"
,
getQueryTimeout
);
getQueryTimeout
.
getParameters
().
get
(
0
).
setValue
(
ValueString
.
get
(
"QUERY_TIMEOUT"
),
false
);
ResultInterface
result
=
getQueryTimeout
.
executeQuery
(
0
,
false
);
result
.
next
();
int
queryTimeout
=
result
.
currentRow
()[
0
].
getInt
();
result
.
close
();
if
(
queryTimeout
==
0
)
{
return
0
;
if
(
queryTimeoutCache
==
-
1
)
{
checkClosed
();
getQueryTimeout
=
prepareCommand
(
"SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME=?"
,
getQueryTimeout
);
getQueryTimeout
.
getParameters
().
get
(
0
).
setValue
(
ValueString
.
get
(
"QUERY_TIMEOUT"
),
false
);
ResultInterface
result
=
getQueryTimeout
.
executeQuery
(
0
,
false
);
result
.
next
();
int
queryTimeout
=
result
.
currentRow
()[
0
].
getInt
();
result
.
close
();
if
(
queryTimeout
!=
0
)
{
// round to the next second, otherwise 999 millis would return 0 seconds
queryTimeout
=
(
queryTimeout
+
999
)
/
1000
;
}
queryTimeoutCache
=
queryTimeout
;
}
// round to the next second, otherwise 999 millis would return 0 seconds
return
(
queryTimeout
+
999
)
/
1000
;
return
queryTimeoutCache
;
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
...
...
h2/src/main/org/h2/jdbc/JdbcStatement.java
浏览文件 @
b1edabaa
...
...
@@ -521,6 +521,10 @@ public class JdbcStatement extends TraceObject implements Statement {
* Gets the current query timeout in seconds.
* This method will return 0 if no query timeout is set.
* The result is rounded to the next second.
* For performance reasons, only the first call to this method
* will query the database. If the query timeout was changed in another
* way than calling setQueryTimeout, this method will always return
* the last value.
*
* @return the timeout in seconds
* @throws SQLException if this object is closed
...
...
@@ -536,14 +540,13 @@ public class JdbcStatement extends TraceObject implements Statement {
}
/**
* Sets the current query timeout in seconds. Calling this method will
* commit an open transaction, even if the value is the same as before.
* Changing the value will affect all statements of this connection. This
* method does not commit a transaction, and rolling back a transaction does
* not affect this setting.
* Sets the current query timeout in seconds.
* Changing the value will affect all statements of this connection.
* This method does not commit a transaction,
* and rolling back a transaction does not affect this setting.
*
* @param seconds the timeout in seconds - 0 means no timeout, values
*
smaller 0 will throw an exception
* smaller 0 will throw an exception
* @throws SQLException if this object is closed
*/
public
void
setQueryTimeout
(
int
seconds
)
throws
SQLException
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论