Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b2a70c1c
提交
b2a70c1c
authored
10月 16, 2015
作者:
Thomas Mueller Graf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The condition in(select...) did not work correctly in some cases if the subquery was ordered
上级
804c05b1
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
48 行增加
和
11 行删除
+48
-11
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
Query.java
h2/src/main/org/h2/command/dml/Query.java
+7
-0
Select.java
h2/src/main/org/h2/command/dml/Select.java
+5
-0
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+5
-0
ConditionInSelect.java
h2/src/main/org/h2/expression/ConditionInSelect.java
+3
-1
LocalResult.java
h2/src/main/org/h2/result/LocalResult.java
+12
-8
testScript.sql
h2/src/test/org/h2/test/testScript.sql
+13
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
b2a70c1c
...
@@ -21,9 +21,11 @@ Change Log
...
@@ -21,9 +21,11 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul>
<ul>
<li>
The condition "in(select...)" did not work correctly in some cases if the subquery had an "order by".
</li>
<li>
Issue #184: The Platform-independent zip had Windows line endings in Linux scripts.
<li>
Issue #184: The Platform-independent zip had Windows line endings in Linux scripts.
</li>
</li>
<li>
The "script" command did not include sequences of temporary tables.
<li>
Issue #186:
The "script" command did not include sequences of temporary tables.
</li>
</li>
</ul>
</ul>
...
...
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
b2a70c1c
...
@@ -130,6 +130,13 @@ public abstract class Query extends Prepared {
...
@@ -130,6 +130,13 @@ public abstract class Query extends Prepared {
*/
*/
public
abstract
void
setOrder
(
ArrayList
<
SelectOrderBy
>
order
);
public
abstract
void
setOrder
(
ArrayList
<
SelectOrderBy
>
order
);
/**
* Whether the query has an order.
*
* @return true if it has
*/
public
abstract
boolean
hasOrder
();
/**
/**
* Set the 'for update' flag.
* Set the 'for update' flag.
*
*
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
b2a70c1c
...
@@ -143,6 +143,11 @@ public class Select extends Query {
...
@@ -143,6 +143,11 @@ public class Select extends Query {
orderList
=
order
;
orderList
=
order
;
}
}
@Override
public
boolean
hasOrder
()
{
return
orderList
!=
null
||
sort
!=
null
;
}
/**
/**
* Add a condition to the list of conditions.
* Add a condition to the list of conditions.
*
*
...
...
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
b2a70c1c
...
@@ -102,6 +102,11 @@ public class SelectUnion extends Query {
...
@@ -102,6 +102,11 @@ public class SelectUnion extends Query {
orderList
=
order
;
orderList
=
order
;
}
}
@Override
public
boolean
hasOrder
()
{
return
orderList
!=
null
||
sort
!=
null
;
}
private
Value
[]
convert
(
Value
[]
values
,
int
columnCount
)
{
private
Value
[]
convert
(
Value
[]
values
,
int
columnCount
)
{
Value
[]
newValues
;
Value
[]
newValues
;
if
(
columnCount
==
values
.
length
)
{
if
(
columnCount
==
values
.
length
)
{
...
...
h2/src/main/org/h2/expression/ConditionInSelect.java
浏览文件 @
b2a70c1c
...
@@ -43,7 +43,9 @@ public class ConditionInSelect extends Condition {
...
@@ -43,7 +43,9 @@ public class ConditionInSelect extends Condition {
@Override
@Override
public
Value
getValue
(
Session
session
)
{
public
Value
getValue
(
Session
session
)
{
query
.
setSession
(
session
);
query
.
setSession
(
session
);
query
.
setDistinct
(
true
);
if
(!
query
.
hasOrder
())
{
query
.
setDistinct
(
true
);
}
LocalResult
rows
=
query
.
query
(
0
);
LocalResult
rows
=
query
.
query
(
0
);
try
{
try
{
Value
l
=
left
.
getValue
(
session
);
Value
l
=
left
.
getValue
(
session
);
...
...
h2/src/main/org/h2/result/LocalResult.java
浏览文件 @
b2a70c1c
...
@@ -206,13 +206,8 @@ public class LocalResult implements ResultInterface, ResultTarget {
...
@@ -206,13 +206,8 @@ public class LocalResult implements ResultInterface, ResultTarget {
if
(
distinctRows
==
null
)
{
if
(
distinctRows
==
null
)
{
distinctRows
=
ValueHashMap
.
newInstance
();
distinctRows
=
ValueHashMap
.
newInstance
();
for
(
Value
[]
row
:
rows
)
{
for
(
Value
[]
row
:
rows
)
{
if
(
row
.
length
>
visibleColumnCount
)
{
ValueArray
array
=
getArrayOfVisible
(
row
);
Value
[]
r2
=
new
Value
[
visibleColumnCount
];
distinctRows
.
put
(
array
,
array
.
getList
());
System
.
arraycopy
(
row
,
0
,
r2
,
0
,
visibleColumnCount
);
row
=
r2
;
}
ValueArray
array
=
ValueArray
.
get
(
row
);
distinctRows
.
put
(
array
,
row
);
}
}
}
}
ValueArray
array
=
ValueArray
.
get
(
values
);
ValueArray
array
=
ValueArray
.
get
(
values
);
...
@@ -271,6 +266,15 @@ public class LocalResult implements ResultInterface, ResultTarget {
...
@@ -271,6 +266,15 @@ public class LocalResult implements ResultInterface, ResultTarget {
}
}
}
}
private
ValueArray
getArrayOfVisible
(
Value
[]
values
)
{
if
(
values
.
length
>
visibleColumnCount
)
{
Value
[]
v2
=
new
Value
[
visibleColumnCount
];
System
.
arraycopy
(
values
,
0
,
v2
,
0
,
visibleColumnCount
);
values
=
v2
;
}
return
ValueArray
.
get
(
values
);
}
/**
/**
* Add a row to this object.
* Add a row to this object.
*
*
...
@@ -281,7 +285,7 @@ public class LocalResult implements ResultInterface, ResultTarget {
...
@@ -281,7 +285,7 @@ public class LocalResult implements ResultInterface, ResultTarget {
cloneLobs
(
values
);
cloneLobs
(
values
);
if
(
distinct
)
{
if
(
distinct
)
{
if
(
distinctRows
!=
null
)
{
if
(
distinctRows
!=
null
)
{
ValueArray
array
=
ValueArray
.
get
(
values
);
ValueArray
array
=
getArrayOfVisible
(
values
);
distinctRows
.
put
(
array
,
values
);
distinctRows
.
put
(
array
,
values
);
rowCount
=
distinctRows
.
size
();
rowCount
=
distinctRows
.
size
();
if
(
rowCount
>
maxMemoryRows
)
{
if
(
rowCount
>
maxMemoryRows
)
{
...
...
h2/src/test/org/h2/test/testScript.sql
浏览文件 @
b2a70c1c
...
@@ -3,6 +3,18 @@
...
@@ -3,6 +3,18 @@
-- Initial Developer: H2 Group
-- Initial Developer: H2 Group
--
--
--- special grammar and test cases ---------------------------------------------------------------------------------------------
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create
table
test
(
id
int
)
as
select
1
;
>
ok
select
*
from
test
where
id
in
(
select
id
from
test
order
by
'x'
);
>
ID
>
--
>
1
>
rows
(
ordered
):
1
drop
table
test
;
>
ok
select
abs
(
cast
(
0
.
0
as
double
))
x
;
select
abs
(
cast
(
0
.
0
as
double
))
x
;
>
X
>
X
>
---
>
---
...
@@ -62,7 +74,7 @@ LIMIT 2 )
...
@@ -62,7 +74,7 @@ LIMIT 2 )
AND
studentID
=
2
;
AND
studentID
=
2
;
>
SUM
(
POINTS
)
>
SUM
(
POINTS
)
>
-----------
>
-----------
>
null
>
30
>
rows
(
ordered
):
1
>
rows
(
ordered
):
1
SELECT
eventID
X
FROM
RESULTS
SELECT
eventID
X
FROM
RESULTS
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论