Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8c989d7f
提交
8c989d7f
authored
13 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue 387: WHERE condition getting pushed into sub-query with LIMIT.
上级
33f44932
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
38 行增加
和
1 行删除
+38
-1
changelog.html
h2/src/docsrc/html/changelog.html
+1
-1
Query.java
h2/src/main/org/h2/command/dml/Query.java
+9
-0
Select.java
h2/src/main/org/h2/command/dml/Select.java
+7
-0
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+4
-0
ViewIndex.java
h2/src/main/org/h2/index/ViewIndex.java
+3
-0
test-1.3.txt
h2/src/test/org/h2/test/test-1.3.txt
+14
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
8c989d7f
...
...
@@ -18,7 +18,7 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
-
<ul><li>
Issue 387: WHERE condition getting pushed into sub-query with LIMIT.
</li></ul>
<h2>
Version 1.3.165 (2012-03-18)
</h2>
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
8c989d7f
...
...
@@ -171,6 +171,15 @@ public abstract class Query extends Prepared {
*/
public
abstract
void
addGlobalCondition
(
Parameter
param
,
int
columnId
,
int
comparisonType
);
/**
* Check whether adding condition to the query is allowed. This is not
* allowed for views that have an order by and a limit, as it would affect
* the returned results.
*
* @return true if adding global conditions is allowed
*/
public
abstract
boolean
allowGlobalConditions
();
/**
* Check if this expression and all sub-expressions can fulfill a criteria.
* If any part returns false, the result is false.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
8c989d7f
...
...
@@ -1258,4 +1258,11 @@ public class Select extends Query {
return
CommandInterface
.
SELECT
;
}
public
boolean
allowGlobalConditions
()
{
if
(
offsetExpr
==
null
&&
(
limitExpr
==
null
||
sort
==
null
))
{
return
true
;
}
return
false
;
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
8c989d7f
...
...
@@ -413,4 +413,8 @@ public class SelectUnion extends Query {
return
CommandInterface
.
SELECT
;
}
public
boolean
allowGlobalConditions
()
{
return
left
.
allowGlobalConditions
()
&&
right
.
allowGlobalConditions
();
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/ViewIndex.java
浏览文件 @
8c989d7f
...
...
@@ -260,6 +260,9 @@ public class ViewIndex extends BaseIndex {
if
(
masks
==
null
)
{
return
q
;
}
if
(!
q
.
allowGlobalConditions
())
{
return
q
;
}
int
firstIndexParam
=
originalParameters
==
null
?
0
:
originalParameters
.
size
();
firstIndexParam
+=
view
.
getParameterOffset
();
IntArray
paramIndex
=
new
IntArray
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/test-1.3.txt
浏览文件 @
8c989d7f
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(id int, name varchar);
> ok
insert into test values(5, 'b'), (5, 'b'), (20, 'a');
> update count: 3
select * from (select * from test order by name limit 1) where id < 10;
> ID NAME
> -- ----
> rows (ordered): 0
drop table test;
> ok
create table test (id int not null, pid int);
> ok
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论