Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f5c3bd9d
提交
f5c3bd9d
authored
2月 08, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clear CTEs of previous commands in list for safety
上级
e7211e7e
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
21 行增加
和
9 行删除
+21
-9
CommandContainer.java
h2/src/main/org/h2/command/CommandContainer.java
+4
-0
CommandList.java
h2/src/main/org/h2/command/CommandList.java
+3
-3
Parser.java
h2/src/main/org/h2/command/Parser.java
+14
-6
没有找到文件。
h2/src/main/org/h2/command/CommandContainer.java
浏览文件 @
f5c3bd9d
...
@@ -185,4 +185,8 @@ public class CommandContainer extends Command {
...
@@ -185,4 +185,8 @@ public class CommandContainer extends Command {
return
prepared
.
getType
();
return
prepared
.
getType
();
}
}
void
clearCTE
()
{
clearCTE
(
session
,
prepared
);
}
}
}
h2/src/main/org/h2/command/CommandList.java
浏览文件 @
f5c3bd9d
...
@@ -17,10 +17,10 @@ import org.h2.result.ResultInterface;
...
@@ -17,10 +17,10 @@ import org.h2.result.ResultInterface;
*/
*/
class
CommandList
extends
Command
{
class
CommandList
extends
Command
{
private
final
ArrayList
<
Command
>
commands
;
private
final
ArrayList
<
Command
Container
>
commands
;
private
final
ArrayList
<
Parameter
>
parameters
;
private
final
ArrayList
<
Parameter
>
parameters
;
CommandList
(
Session
session
,
String
sql
,
ArrayList
<
Command
>
commands
,
ArrayList
<
Parameter
>
parameters
)
{
CommandList
(
Session
session
,
String
sql
,
ArrayList
<
Command
Container
>
commands
,
ArrayList
<
Parameter
>
parameters
)
{
super
(
session
,
sql
);
super
(
session
,
sql
);
this
.
commands
=
commands
;
this
.
commands
=
commands
;
this
.
parameters
=
parameters
;
this
.
parameters
=
parameters
;
...
@@ -33,7 +33,7 @@ class CommandList extends Command {
...
@@ -33,7 +33,7 @@ class CommandList extends Command {
private
void
executeRemaining
()
{
private
void
executeRemaining
()
{
for
(
int
i
=
1
,
l
=
commands
.
size
();
i
<
l
;
i
++)
{
for
(
int
i
=
1
,
l
=
commands
.
size
();
i
<
l
;
i
++)
{
Command
command
=
commands
.
get
(
i
);
Command
Container
command
=
commands
.
get
(
i
);
if
(
command
.
isQuery
())
{
if
(
command
.
isQuery
())
{
command
.
query
(
0
);
command
.
query
(
0
);
}
else
{
}
else
{
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
f5c3bd9d
...
@@ -673,11 +673,11 @@ public class Parser {
...
@@ -673,11 +673,11 @@ public class Parser {
*/
*/
public
Command
prepareCommand
(
String
sql
)
{
public
Command
prepareCommand
(
String
sql
)
{
try
{
try
{
Command
c
=
prepareSingleCommand
(
sql
);
Command
Container
c
=
prepareSingleCommand
(
sql
);
if
(
currentTokenType
==
SEMICOLON
)
{
if
(
currentTokenType
==
SEMICOLON
)
{
String
remaining
=
originalSQL
.
substring
(
parseIndex
);
String
remaining
=
originalSQL
.
substring
(
parseIndex
);
if
(!
StringUtils
.
isWhitespaceOrEmpty
(
remaining
))
{
if
(!
StringUtils
.
isWhitespaceOrEmpty
(
remaining
))
{
c
=
prepareCommandList
(
c
,
sql
,
remaining
);
return
prepareCommandList
(
c
,
sql
,
remaining
);
}
}
}
}
return
c
;
return
c
;
...
@@ -686,19 +686,27 @@ public class Parser {
...
@@ -686,19 +686,27 @@ public class Parser {
}
}
}
}
private
Command
prepareCommandList
(
Command
c
,
String
sql
,
String
remaining
)
{
private
Command
List
prepareCommandList
(
CommandContainer
c
,
String
sql
,
String
remaining
)
{
ArrayList
<
Command
>
list
=
Utils
.
newSmallArrayList
();
ArrayList
<
Command
Container
>
list
=
Utils
.
newSmallArrayList
();
list
.
add
(
c
);
list
.
add
(
c
);
do
{
do
{
suppliedParameters
=
parameters
;
suppliedParameters
=
parameters
;
suppliedParameterList
=
indexedParameterList
;
suppliedParameterList
=
indexedParameterList
;
list
.
add
(
prepareSingleCommand
(
remaining
));
try
{
c
=
prepareSingleCommand
(
remaining
);
}
catch
(
Throwable
t
)
{
for
(
CommandContainer
cc
:
list
)
{
cc
.
clearCTE
();
}
throw
t
;
}
list
.
add
(
c
);
}
while
(
currentTokenType
==
SEMICOLON
}
while
(
currentTokenType
==
SEMICOLON
&&
!
StringUtils
.
isWhitespaceOrEmpty
(
remaining
=
originalSQL
.
substring
(
parseIndex
)));
&&
!
StringUtils
.
isWhitespaceOrEmpty
(
remaining
=
originalSQL
.
substring
(
parseIndex
)));
return
new
CommandList
(
session
,
sql
,
list
,
parameters
);
return
new
CommandList
(
session
,
sql
,
list
,
parameters
);
}
}
private
Command
prepareSingleCommand
(
String
sql
)
{
private
Command
Container
prepareSingleCommand
(
String
sql
)
{
Prepared
p
=
parse
(
sql
);
Prepared
p
=
parse
(
sql
);
if
(
currentTokenType
!=
SEMICOLON
&&
currentTokenType
!=
END
)
{
if
(
currentTokenType
!=
SEMICOLON
&&
currentTokenType
!=
END
)
{
addExpected
(
SEMICOLON
);
addExpected
(
SEMICOLON
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论