Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
86f65e5d
提交
86f65e5d
authored
15 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Nested subqueries didn't work for INSERT INTO and IN(..).
上级
16ceecac
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
18 行删除
+17
-18
Parser.java
h2/src/main/org/h2/command/Parser.java
+17
-18
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
86f65e5d
...
@@ -862,6 +862,18 @@ public class Parser {
...
@@ -862,6 +862,18 @@ public class Parser {
return
prep
;
return
prep
;
}
}
private
boolean
isSelect
()
throws
SQLException
{
int
start
=
lastParseIndex
;
while
(
readIf
(
"("
))
{
// need to read ahead, it could be a nested union:
// ((select 1) union (select 1))
}
boolean
select
=
isToken
(
"SELECT"
)
||
isToken
(
"FROM"
);
parseIndex
=
start
;
read
();
return
select
;
}
private
Merge
parseMerge
()
throws
SQLException
{
private
Merge
parseMerge
()
throws
SQLException
{
Merge
command
=
new
Merge
(
session
);
Merge
command
=
new
Merge
(
session
);
currentPrepared
=
command
;
currentPrepared
=
command
;
...
@@ -869,7 +881,7 @@ public class Parser {
...
@@ -869,7 +881,7 @@ public class Parser {
Table
table
=
readTableOrView
();
Table
table
=
readTableOrView
();
command
.
setTable
(
table
);
command
.
setTable
(
table
);
if
(
readIf
(
"("
))
{
if
(
readIf
(
"("
))
{
if
(
is
Token
(
"SELECT"
)
||
isToken
(
"FROM"
))
{
if
(
is
Select
(
))
{
command
.
setQuery
(
parseSelect
());
command
.
setQuery
(
parseSelect
());
read
(
")"
);
read
(
")"
);
return
command
;
return
command
;
...
@@ -913,7 +925,7 @@ public class Parser {
...
@@ -913,7 +925,7 @@ public class Parser {
command
.
setSortedInsertMode
(
true
);
command
.
setSortedInsertMode
(
true
);
}
}
if
(
readIf
(
"("
))
{
if
(
readIf
(
"("
))
{
if
(
is
Token
(
"SELECT"
)
||
isToken
(
"FROM"
))
{
if
(
is
Select
(
))
{
command
.
setQuery
(
parseSelect
());
command
.
setQuery
(
parseSelect
());
read
(
")"
);
read
(
")"
);
return
command
;
return
command
;
...
@@ -950,19 +962,8 @@ public class Parser {
...
@@ -950,19 +962,8 @@ public class Parser {
Table
table
;
Table
table
;
String
alias
=
null
;
String
alias
=
null
;
if
(
readIf
(
"("
))
{
if
(
readIf
(
"("
))
{
// need to read ahead, it could be a nested union or join:
if
(
isSelect
())
{
// select 1 from (((select 1) union (select 1)) union (select 1));
int
start
=
lastParseIndex
;
// select * from ((test d1 inner join test d2 on d1.id = d2.id)
// inner join test d3 on d1.id = d3.id) inner join test d4
// on d4.id = d1.id;
int
start
=
lastParseIndex
;
while
(
readIf
(
"("
))
{
// ignore, but go back later
}
if
(
isToken
(
"SELECT"
)
||
isToken
(
"FROM"
))
{
parseIndex
=
start
;
read
();
start
=
lastParseIndex
;
int
paramIndex
=
parameters
.
size
();
int
paramIndex
=
parameters
.
size
();
Query
query
=
parseSelectUnion
();
Query
query
=
parseSelectUnion
();
read
(
")"
);
read
(
")"
);
...
@@ -982,8 +983,6 @@ public class Parser {
...
@@ -982,8 +983,6 @@ public class Parser {
alias
=
session
.
getNextSystemIdentifier
(
sqlCommand
);
alias
=
session
.
getNextSystemIdentifier
(
sqlCommand
);
table
=
TableView
.
createTempView
(
s
,
session
.
getUser
(),
alias
,
query
,
currentSelect
);
table
=
TableView
.
createTempView
(
s
,
session
.
getUser
(),
alias
,
query
,
currentSelect
);
}
else
{
}
else
{
parseIndex
=
start
;
read
();
TableFilter
top
=
readTableFilter
(
fromOuter
);
TableFilter
top
=
readTableFilter
(
fromOuter
);
top
=
readJoin
(
top
,
currentSelect
,
fromOuter
);
top
=
readJoin
(
top
,
currentSelect
,
fromOuter
);
read
(
")"
);
read
(
")"
);
...
@@ -1755,7 +1754,7 @@ public class Parser {
...
@@ -1755,7 +1754,7 @@ public class Parser {
if
(
readIf
(
")"
))
{
if
(
readIf
(
")"
))
{
r
=
ValueExpression
.
get
(
ValueBoolean
.
get
(
false
));
r
=
ValueExpression
.
get
(
ValueBoolean
.
get
(
false
));
}
else
{
}
else
{
if
(
is
Token
(
"SELECT"
)
||
isToken
(
"FROM"
))
{
if
(
is
Select
(
))
{
Query
query
=
parseSelect
();
Query
query
=
parseSelect
();
r
=
new
ConditionInSelect
(
database
,
r
,
query
,
false
,
Comparison
.
EQUAL
);
r
=
new
ConditionInSelect
(
database
,
r
,
query
,
false
,
Comparison
.
EQUAL
);
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论