Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0840ef36
提交
0840ef36
authored
10月 14, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The wrong parameters were bound to subqueries with parameters.
上级
1f062c6d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
79 行增加
和
33 行删除
+79
-33
Select.java
h2/src/main/org/h2/command/dml/Select.java
+41
-13
SelectOrderBy.java
h2/src/main/org/h2/command/dml/SelectOrderBy.java
+20
-0
TransactionCommand.java
h2/src/main/org/h2/command/dml/TransactionCommand.java
+1
-6
ViewIndex.java
h2/src/main/org/h2/index/ViewIndex.java
+1
-0
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+16
-14
没有找到文件。
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
0840ef36
...
@@ -853,9 +853,9 @@ public class Select extends Query {
...
@@ -853,9 +853,9 @@ public class Select extends Query {
}
}
public
String
getPlanSQL
()
{
public
String
getPlanSQL
()
{
if
(
topTableFilter
==
null
)
{
// can not use the field sqlStatement because the parameter
return
sqlStatement
;
// indexes may be incorrect: ? may be in fact ?2 for a subquery
}
// but indexes may be set manually as well
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
Expression
[]
exprList
=
new
Expression
[
expressions
.
size
()];
Expression
[]
exprList
=
new
Expression
[
expressions
.
size
()];
expressions
.
toArray
(
exprList
);
expressions
.
toArray
(
exprList
);
...
@@ -872,17 +872,25 @@ public class Select extends Query {
...
@@ -872,17 +872,25 @@ public class Select extends Query {
}
}
buff
.
append
(
"\nFROM "
);
buff
.
append
(
"\nFROM "
);
TableFilter
filter
=
topTableFilter
;
TableFilter
filter
=
topTableFilter
;
boolean
join
=
false
;
if
(
filter
!=
null
)
{
int
id
=
0
;
int
i
=
0
;
do
{
do
{
if
(
id
>
0
)
{
if
(
i
>
0
)
{
buff
.
append
(
"\n"
);
buff
.
append
(
"\n"
);
}
buff
.
append
(
filter
.
getPlanSQL
(
i
>
0
));
i
++;
filter
=
filter
.
getJoin
();
}
while
(
filter
!=
null
);
}
else
{
for
(
int
i
=
0
;
i
<
filters
.
size
();
i
++)
{
if
(
i
>
0
)
{
buff
.
append
(
"\n"
);
}
filter
=
(
TableFilter
)
filters
.
get
(
i
);
buff
.
append
(
filter
.
getPlanSQL
(
i
>
0
));
}
}
buff
.
append
(
filter
.
getPlanSQL
(
join
));
}
id
++;
join
=
true
;
filter
=
filter
.
getJoin
();
}
while
(
filter
!=
null
);
if
(
condition
!=
null
)
{
if
(
condition
!=
null
)
{
buff
.
append
(
"\nWHERE "
+
StringUtils
.
unEnclose
(
condition
.
getSQL
()));
buff
.
append
(
"\nWHERE "
+
StringUtils
.
unEnclose
(
condition
.
getSQL
()));
}
}
...
@@ -897,6 +905,16 @@ public class Select extends Query {
...
@@ -897,6 +905,16 @@ public class Select extends Query {
buff
.
append
(
StringUtils
.
unEnclose
(
g
.
getSQL
()));
buff
.
append
(
StringUtils
.
unEnclose
(
g
.
getSQL
()));
}
}
}
}
if
(
group
!=
null
)
{
buff
.
append
(
"\nGROUP BY "
);
for
(
int
i
=
0
;
i
<
group
.
size
();
i
++)
{
Expression
g
=
(
Expression
)
group
.
get
(
i
);
if
(
i
>
0
)
{
buff
.
append
(
", "
);
}
buff
.
append
(
StringUtils
.
unEnclose
(
g
.
getSQL
()));
}
}
if
(
having
!=
null
)
{
if
(
having
!=
null
)
{
// could be set in addGlobalCondition
// could be set in addGlobalCondition
// in this case the query is not run directly, just getPlanSQL is
// in this case the query is not run directly, just getPlanSQL is
...
@@ -911,6 +929,16 @@ public class Select extends Query {
...
@@ -911,6 +929,16 @@ public class Select extends Query {
buff
.
append
(
"\nORDER BY "
);
buff
.
append
(
"\nORDER BY "
);
buff
.
append
(
sort
.
getSQL
(
exprList
,
visibleColumnCount
));
buff
.
append
(
sort
.
getSQL
(
exprList
,
visibleColumnCount
));
}
}
if
(
orderList
!=
null
)
{
buff
.
append
(
"\nORDER BY "
);
for
(
int
i
=
0
;
i
<
orderList
.
size
();
i
++)
{
if
(
i
>
0
)
{
buff
.
append
(
", "
);
}
SelectOrderBy
o
=
(
SelectOrderBy
)
orderList
.
get
(
i
);
buff
.
append
(
StringUtils
.
unEnclose
(
o
.
getSQL
()));
}
}
if
(
limit
!=
null
)
{
if
(
limit
!=
null
)
{
buff
.
append
(
"\nLIMIT "
);
buff
.
append
(
"\nLIMIT "
);
buff
.
append
(
StringUtils
.
unEnclose
(
limit
.
getSQL
()));
buff
.
append
(
StringUtils
.
unEnclose
(
limit
.
getSQL
()));
...
...
h2/src/main/org/h2/command/dml/SelectOrderBy.java
浏览文件 @
0840ef36
...
@@ -39,4 +39,24 @@ public class SelectOrderBy {
...
@@ -39,4 +39,24 @@ public class SelectOrderBy {
* If NULL should be appear at the end.
* If NULL should be appear at the end.
*/
*/
public
boolean
nullsLast
;
public
boolean
nullsLast
;
public
String
getSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
if
(
columnIndexExpr
!=
null
)
{
buff
.
append
(
columnIndexExpr
.
getSQL
());
}
else
{
buff
.
append
(
"="
);
buff
.
append
(
expression
.
getSQL
());
}
if
(
descending
)
{
buff
.
append
(
" DESC"
);
}
if
(
nullsFirst
)
{
buff
.
append
(
" NULLS FIRST"
);
}
else
if
(
nullsLast
)
{
buff
.
append
(
" NULLS LAST"
);
}
return
buff
.
toString
();
}
}
}
h2/src/main/org/h2/command/dml/TransactionCommand.java
浏览文件 @
0840ef36
...
@@ -149,12 +149,7 @@ public class TransactionCommand extends Prepared {
...
@@ -149,12 +149,7 @@ public class TransactionCommand extends Prepared {
break
;
break
;
case
SHUTDOWN_IMMEDIATELY:
case
SHUTDOWN_IMMEDIATELY:
session
.
getUser
().
checkAdmin
();
session
.
getUser
().
checkAdmin
();
session
.
getDatabase
().
setPowerOffCount
(
1
);
session
.
getDatabase
().
shutdownImmediately
();
try
{
session
.
getDatabase
().
checkPowerOff
();
}
catch
(
SQLException
e
)
{
// ignore
}
break
;
break
;
case
SHUTDOWN:
{
case
SHUTDOWN:
{
session
.
getUser
().
checkAdmin
();
session
.
getUser
().
checkAdmin
();
...
...
h2/src/main/org/h2/index/ViewIndex.java
浏览文件 @
0840ef36
...
@@ -157,6 +157,7 @@ public class ViewIndex extends BaseIndex {
...
@@ -157,6 +157,7 @@ public class ViewIndex extends BaseIndex {
for
(
int
i
=
0
;
originalParameters
!=
null
&&
i
<
originalParameters
.
size
();
i
++)
{
for
(
int
i
=
0
;
originalParameters
!=
null
&&
i
<
originalParameters
.
size
();
i
++)
{
Parameter
orig
=
(
Parameter
)
originalParameters
.
get
(
i
);
Parameter
orig
=
(
Parameter
)
originalParameters
.
get
(
i
);
Value
value
=
orig
.
getValue
(
session
);
Value
value
=
orig
.
getValue
(
session
);
idx
=
orig
.
getIndex
();
Parameter
param
=
(
Parameter
)
paramList
.
get
(
idx
++);
Parameter
param
=
(
Parameter
)
paramList
.
get
(
idx
++);
param
.
setValue
(
value
);
param
.
setValue
(
value
);
}
}
...
...
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
0840ef36
...
@@ -510,23 +510,25 @@ public class TableFilter implements ColumnResolver {
...
@@ -510,23 +510,25 @@ public class TableFilter implements ColumnResolver {
buff
.
append
(
' '
);
buff
.
append
(
' '
);
buff
.
append
(
Parser
.
quoteIdentifier
(
alias
));
buff
.
append
(
Parser
.
quoteIdentifier
(
alias
));
}
}
buff
.
append
(
" /* "
);
if
(
index
!=
null
)
{
StringBuffer
planBuff
=
new
StringBuffer
();
buff
.
append
(
" /* "
);
planBuff
.
append
(
index
.
getPlanSQL
());
StringBuffer
planBuff
=
new
StringBuffer
();
if
(
indexConditions
.
size
()
>
0
)
{
planBuff
.
append
(
index
.
getPlanSQL
());
planBuff
.
append
(
": "
);
if
(
indexConditions
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
indexConditions
.
size
();
i
++)
{
planBuff
.
append
(
": "
);
IndexCondition
condition
=
(
IndexCondition
)
indexConditions
.
get
(
i
);
for
(
int
i
=
0
;
i
<
indexConditions
.
size
();
i
++)
{
if
(
i
>
0
)
{
IndexCondition
condition
=
(
IndexCondition
)
indexConditions
.
get
(
i
);
planBuff
.
append
(
" AND "
);
if
(
i
>
0
)
{
planBuff
.
append
(
" AND "
);
}
planBuff
.
append
(
condition
.
getSQL
());
}
}
planBuff
.
append
(
condition
.
getSQL
());
}
}
String
plan
=
planBuff
.
toString
();
plan
=
StringUtils
.
quoteRemarkSQL
(
plan
);
buff
.
append
(
plan
);
buff
.
append
(
" */"
);
}
}
String
plan
=
planBuff
.
toString
();
plan
=
StringUtils
.
quoteRemarkSQL
(
plan
);
buff
.
append
(
plan
);
buff
.
append
(
" */"
);
if
(
join
)
{
if
(
join
)
{
buff
.
append
(
" ON "
);
buff
.
append
(
" ON "
);
if
(
joinCondition
==
null
)
{
if
(
joinCondition
==
null
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论