Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c05cc247
提交
c05cc247
authored
5月 22, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Conditions of the form columnName IS NULL now use an index.
上级
4100f056
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
51 行增加
和
14 行删除
+51
-14
changelog.html
h2/src/docsrc/html/changelog.html
+9
-7
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+6
-0
Comparison.java
h2/src/main/org/h2/expression/Comparison.java
+11
-3
IndexCursor.java
h2/src/main/org/h2/index/IndexCursor.java
+25
-4
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
c05cc247
...
...
@@ -18,14 +18,16 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
H2 Console: when the settings were not stored yet (for example when running for the first time),
the last recently used settings were not stored. A workaround was to create the file
".h2.server.properties" manually in the current user home directory, with the contents:
webAllowOthers=false, webPort=8082, webSSL=false,
0=Generic H2 (Embedded)|org.h2.Driver|jdbc\:h2\:~/test|sa
(where a comma is a newline).
<ul><li>
Conditions of the form columnName IS NULL now use an index. To disable this feature,
set the system property h2.optimizeIsNull to false.
</li><li>
H2 Console: when the settings were not stored yet (for example when running for the first time),
the last recently used settings were not stored. A workaround was to create the file
".h2.server.properties" manually in the current user home directory, with the contents:
webAllowOthers=false, webPort=8082, webSSL=false,
0=Generic H2 (Embedded)|org.h2.Driver|jdbc\:h2\:~/test|sa
(where a comma is a newline).
</li><li>
The source code is now switched to Java 6 (JDK 1.6) by default.
Java 5 (JDK 1.5) is still supported, and the jar file is still compiled for Java 5.
Java 5 (JDK 1.5) is still supported, and the jar file is still compiled for Java 5.
</li><li>
The BOM (the byte-order-mark) character 0xfeff at the beginning of the file is ignored.
This is for compatibility with Microsoft Excel.
</li><li>
When opening an existing database, the cache size is set to at most
...
...
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
c05cc247
...
...
@@ -433,6 +433,12 @@ public class SysProperties {
*/
public
static
final
boolean
OPTIMIZE_IN_LIST
=
getBooleanSetting
(
"h2.optimizeInList"
,
true
);
/**
* System property <code>h2.optimizeIsNull</code> (default: false).<br />
* Use an index for condition of the form columnName IS NULL.
*/
public
static
final
boolean
OPTIMIZE_IS_NULL
=
getBooleanSetting
(
"h2.optimizeIsNull"
,
true
);
/**
* System property <code>h2.optimizeOr</code> (default: false).<br />
* Convert (C=? OR C=?) to (C IN(?, ?)).
...
...
h2/src/main/org/h2/expression/Comparison.java
浏览文件 @
c05cc247
...
...
@@ -283,9 +283,6 @@ public class Comparison extends Condition {
}
public
void
createIndexConditions
(
Session
session
,
TableFilter
filter
)
{
if
(
right
==
null
)
{
return
;
}
ExpressionColumn
l
=
null
;
if
(
left
instanceof
ExpressionColumn
)
{
l
=
(
ExpressionColumn
)
left
;
...
...
@@ -293,6 +290,17 @@ public class Comparison extends Condition {
l
=
null
;
}
}
if
(
right
==
null
)
{
if
(
l
!=
null
)
{
switch
(
compareType
)
{
case
IS_NULL:
if
(
SysProperties
.
OPTIMIZE_IS_NULL
)
{
filter
.
addIndexCondition
(
IndexCondition
.
get
(
Comparison
.
EQUAL
,
l
,
ValueExpression
.
getNull
()));
}
}
}
return
;
}
ExpressionColumn
r
=
null
;
if
(
right
instanceof
ExpressionColumn
)
{
r
=
(
ExpressionColumn
)
right
;
...
...
h2/src/main/org/h2/index/IndexCursor.java
浏览文件 @
c05cc247
...
...
@@ -8,6 +8,8 @@ package org.h2.index;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Session
;
import
org.h2.expression.Comparison
;
import
org.h2.message.DbException
;
...
...
@@ -117,10 +119,12 @@ public class IndexCursor implements Cursor {
inList
=
null
;
inResult
=
null
;
}
if
(
isStart
&&
isEnd
)
{
if
(
v
==
ValueNull
.
INSTANCE
)
{
// join on a column=NULL is always false
alwaysFalse
=
true
;
if
(!
SysProperties
.
OPTIMIZE_IS_NULL
)
{
if
(
isStart
&&
isEnd
)
{
if
(
v
==
ValueNull
.
INSTANCE
)
{
// join on a column=NULL is always false
alwaysFalse
=
true
;
}
}
}
}
...
...
@@ -166,7 +170,24 @@ public class IndexCursor implements Cursor {
}
else
if
(
b
==
null
)
{
return
a
;
}
if
(
SysProperties
.
OPTIMIZE_IS_NULL
)
{
// IS NULL must be checked later
if
(
a
==
ValueNull
.
INSTANCE
)
{
return
b
;
}
else
if
(
b
==
ValueNull
.
INSTANCE
)
{
return
a
;
}
}
int
comp
=
a
.
compareTo
(
b
,
table
.
getDatabase
().
getCompareMode
());
if
(
comp
==
0
)
{
return
a
;
}
if
(
SysProperties
.
OPTIMIZE_IS_NULL
)
{
if
(
a
==
ValueNull
.
INSTANCE
||
b
==
ValueNull
.
INSTANCE
)
{
// column IS NULL AND column <op> <not null> is always false
return
null
;
}
}
if
(!
bigger
)
{
comp
=
-
comp
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论