Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8564ab61
提交
8564ab61
authored
7月 25, 2017
作者:
Owner
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'Issue#576' of
https://github.com/stumc/h2database
into Issue#576
上级
62b941ed
b983458d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
51 行增加
和
24 行删除
+51
-24
Command.java
h2/src/main/org/h2/command/Command.java
+8
-13
Parser.java
h2/src/main/org/h2/command/Parser.java
+20
-10
Session.java
h2/src/main/org/h2/engine/Session.java
+16
-0
help.csv
h2/src/main/org/h2/res/help.csv
+7
-1
没有找到文件。
h2/src/main/org/h2/command/Command.java
浏览文件 @
8564ab61
...
...
@@ -172,6 +172,7 @@ public abstract class Command implements CommandInterface {
trace
.
info
(
"slow query: {0} ms"
,
timeMillis
);
}
}
session
.
commandCleanup
(
this
);
}
/**
...
...
@@ -233,7 +234,6 @@ public abstract class Command implements CommandInterface {
}
finally
{
if
(
callStop
)
{
stop
();
commandCleanup
();
}
if
(
writing
)
{
database
.
afterWriting
();
...
...
@@ -293,7 +293,6 @@ public abstract class Command implements CommandInterface {
try
{
if
(
callStop
)
{
stop
();
commandCleanup
();
}
}
finally
{
if
(
writing
)
{
...
...
@@ -304,17 +303,6 @@ public abstract class Command implements CommandInterface {
}
}
private
void
commandCleanup
()
{
if
(
cleanupCallbacks
!=
null
){
for
(
Runnable
eachCleanup:
cleanupCallbacks
){
eachCleanup
.
run
();
// clean up done - must restart query (and dependency construction) to reuse
canReuse
=
false
;
}
cleanupCallbacks
.
clear
();
}
}
private
long
filterConcurrentUpdate
(
DbException
e
,
long
start
)
{
int
errorCode
=
e
.
getErrorCode
();
if
(
errorCode
!=
ErrorCode
.
CONCURRENT_UPDATE_1
&&
...
...
@@ -391,4 +379,11 @@ public abstract class Command implements CommandInterface {
this
.
cleanupCallbacks
=
cleanupCallbacks
;
}
public
List
<
Runnable
>
getCleanupCallbacks
()
{
return
cleanupCallbacks
;
}
public
void
setCanReuse
(
boolean
canReuse
)
{
this
.
canReuse
=
canReuse
;
}
}
h2/src/main/org/h2/command/Parser.java
浏览文件 @
8564ab61
...
...
@@ -4914,6 +4914,25 @@ public class Parser {
return
command
;
}
private
class
WithCleanup
implements
Runnable
{
TableView
view
;
Session
session
;
public
WithCleanup
(
TableView
view
,
Session
session
){
this
.
view
=
view
;
this
.
session
=
session
;
}
@Override
public
void
run
()
{
// check if view was previously deleted as their name is set to null
if
(
view
.
getName
()!=
null
)
{
session
.
removeLocalTempTable
(
view
);
}
}
}
private
Prepared
parseWith
()
{
List
<
TableView
>
viewsCreated
=
new
ArrayList
<
TableView
>();
readIf
(
"RECURSIVE"
);
...
...
@@ -4957,7 +4976,6 @@ public class Parser {
else
{
throw
DbException
.
get
(
ErrorCode
.
SYNTAX_ERROR_1
,
WITH_STATEMENT_SUPPORTS_LIMITED_STATEMENTS
);
}
List
<
Runnable
>
cleanupCallbacks
=
new
ArrayList
<
Runnable
>();
...
...
@@ -4969,15 +4987,7 @@ public class Parser {
if
(
view
==
null
){
continue
;
}
cleanupCallbacks
.
add
(
new
Runnable
(){
@Override
public
void
run
()
{
// check if view was previously deleted as their name is set to null
if
(
view
.
getName
()!=
null
)
{
session
.
removeLocalTempTable
(
view
);
}
}
});
cleanupCallbacks
.
add
(
new
WithCleanup
(
view
,
session
));
}
p
.
setCleanupCallbacks
(
cleanupCallbacks
);
return
p
;
...
...
h2/src/main/org/h2/engine/Session.java
100644 → 100755
浏览文件 @
8564ab61
...
...
@@ -1707,6 +1707,22 @@ public class Session extends SessionWithState {
tablesToAnalyze
.
add
(
table
);
}
/**
* Clean up after the command was run in the session
*
* @param command the command to cleanup for
*/
public
void
commandCleanup
(
Command
command
)
{
if
(
command
.
getCleanupCallbacks
()!=
null
){
for
(
Runnable
eachCleanup
:
command
.
getCleanupCallbacks
()){
eachCleanup
.
run
();
// clean up done - must restart query (and dependency construction) to reuse
command
.
setCanReuse
(
false
);
}
command
.
getCleanupCallbacks
().
clear
();
}
}
/**
* Represents a savepoint (a position in a transaction to where one can roll
* back to).
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
8564ab61
...
...
@@ -69,7 +69,7 @@ Lists the schemas, tables, or the columns of a table."
"Commands (DML)","WITH","
WITH [ RECURSIVE ] { name [( columnName [,...] )]
AS ( select ) [,...] }
select
{ select | insert | update | merge | delete | createTable }
","
Can be used to create a recursive or non-recursive query (common table expression)."
"Commands (DDL)","ALTER INDEX RENAME","
...
...
@@ -381,6 +381,12 @@ SET BINARY_COLLATION
","
Sets the collation used for comparing BINARY columns, the default is SIGNED
for version 1."
"Commands (Other)","SET BUILTIN_ALIAS_OVERRIDE","
SET BUILTIN_ALIAS_OVERRIDE
{ TRUE | FALSE } ] }
","
Allows the overriding of the builtin system date/time functions
for unit testing purposes."
"Commands (Other)","SET COLLATION","
SET [ DATABASE ] COLLATION
{ OFF | collationName [ STRENGTH { PRIMARY | SECONDARY | TERTIARY | IDENTICAL } ] }
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论