Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2b22f40b
提交
2b22f40b
authored
5月 10, 2012
作者:
Steve McLeod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DatabaseEventListener now calls setProgress periodically while a query statement is running
上级
44649f78
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
27 行增加
和
3 行删除
+27
-3
changelog.html
h2/src/docsrc/html/changelog.html
+1
-0
DatabaseEventListener.java
h2/src/main/org/h2/api/DatabaseEventListener.java
+5
-0
Prepared.java
h2/src/main/org/h2/command/Prepared.java
+11
-0
help.csv
h2/src/main/org/h2/res/help.csv
+1
-1
TestListener.java
h2/src/test/org/h2/test/db/TestListener.java
+1
-1
TestDatabaseEventListener.java
h2/src/test/org/h2/test/jdbc/TestDatabaseEventListener.java
+8
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
2b22f40b
...
...
@@ -29,6 +29,7 @@ Change Log
</li><li>
Then reading from a resource using the prefix "classpath:", the ContextClassLoader
is now used if the resource can't be read otherwise.
</li><li>
DatabaseEventListener now calls setProgress whenever a statement starts and ends.
</li><li>
DatabaseEventListener now calls setProgress periodically while a statement is running.
</li><li>
The table INFORMATION_SCHEMA.FUNCTION_ALIASES now includes a column TYPE_NAME.
</li><li>
Issue 378: when using views, the wrong values were bound to a parameter in some cases.
</li><li>
Terrence Huang has translated the error messages to Chinese. Thanks a lot!
...
...
h2/src/main/org/h2/api/DatabaseEventListener.java
浏览文件 @
2b22f40b
...
...
@@ -54,6 +54,11 @@ public interface DatabaseEventListener extends EventListener {
*/
int
STATE_STATEMENT_END
=
6
;
/**
* This state is used for periodic notification during long-running queries
*/
int
STATE_STATEMENT_PROGRESS
=
7
;
/**
* This method is called just after creating the object.
* This is done when opening the database if the listener is specified
...
...
h2/src/main/org/h2/command/Prepared.java
浏览文件 @
2b22f40b
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
command
;
import
java.util.ArrayList
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.constant.ErrorCode
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
...
...
@@ -331,6 +332,7 @@ public abstract class Prepared {
checkCanceled
();
}
this
.
currentRowNumber
=
rowNumber
;
setProgress
();
}
/**
...
...
@@ -342,6 +344,15 @@ public abstract class Prepared {
return
currentRowNumber
;
}
/**
* Notifies query progress via the DatabaseEventListener
*/
private
void
setProgress
()
{
if
((
currentRowNumber
&
127
)
==
0
)
{
session
.
getDatabase
().
setProgress
(
DatabaseEventListener
.
STATE_STATEMENT_PROGRESS
,
sqlStatement
,
currentRowNumber
,
0
);
}
}
/**
* Convert the statement to a String.
*
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
2b22f40b
...
...
@@ -973,7 +973,7 @@ HASH(algorithmString, dataBytes, iterationInt)
","
Calculate the hash value using an algorithm, and repeat this process for a number of iterations."
"Functions (Numeric)","TRUNCATE","
TRUNCATE
(numeric, digitsInt)
{ TRUNC | TRUNCATE }
(numeric, digitsInt)
","
Truncates to a number of digits (to the next value closer to 0)."
"Functions (Numeric)","COMPRESS","
...
...
h2/src/test/org/h2/test/db/TestListener.java
浏览文件 @
2b22f40b
...
...
@@ -69,7 +69,7 @@ public class TestListener extends TestBase implements DatabaseEventListener {
if
(
state
==
lastState
&&
time
<
last
+
1000
)
{
return
;
}
if
(
state
==
STATE_STATEMENT_START
||
state
==
STATE_STATEMENT_END
)
{
if
(
state
==
STATE_STATEMENT_START
||
state
==
STATE_STATEMENT_END
||
state
==
STATE_STATEMENT_PROGRESS
)
{
return
;
}
if
(
name
.
length
()
>
30
)
{
...
...
h2/src/test/org/h2/test/jdbc/TestDatabaseEventListener.java
浏览文件 @
2b22f40b
...
...
@@ -23,7 +23,7 @@ import org.h2.test.TestBase;
public
class
TestDatabaseEventListener
extends
TestBase
implements
DatabaseEventListener
{
private
static
boolean
calledOpened
,
calledClosingDatabase
,
calledScan
,
calledCreateIndex
;
private
static
boolean
calledStatementStart
,
calledStatementEnd
;
private
static
boolean
calledStatementStart
,
calledStatementEnd
,
calledStatementProgress
;
/**
* Run just this test.
...
...
@@ -218,6 +218,7 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent
p
.
setProperty
(
"password"
,
"sa"
);
calledStatementStart
=
false
;
calledStatementEnd
=
false
;
calledStatementProgress
=
false
;
p
.
put
(
"DATABASE_EVENT_LISTENER"
,
getClass
().
getName
());
org
.
h2
.
Driver
.
load
();
String
url
=
"jdbc:h2:mem:databaseEventListener"
;
...
...
@@ -228,6 +229,7 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent
conn
.
close
();
assertTrue
(
calledStatementStart
);
assertTrue
(
calledStatementEnd
);
assertTrue
(
calledStatementProgress
);
}
public
void
closingDatabase
()
{
...
...
@@ -265,6 +267,11 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent
calledStatementEnd
=
true
;
}
}
if
(
state
==
STATE_STATEMENT_PROGRESS
)
{
if
(
name
.
equals
(
"select * from test"
))
{
calledStatementProgress
=
true
;
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论