Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7387be71
提交
7387be71
authored
3月 20, 2015
作者:
noelgrandin@gmail.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add toString() for debugging purposes
上级
54efc692
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
50 行增加
和
11 行删除
+50
-11
IndexCondition.java
h2/src/main/org/h2/index/IndexCondition.java
+50
-11
没有找到文件。
h2/src/main/org/h2/index/IndexCondition.java
浏览文件 @
7387be71
/*
/*
* Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
* Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
and the
*
and the EPL 1.0 (http://h2database.com/html/license.html).
*
EPL 1.0 (http://h2database.com/html/license.html). Initial Developer: H2
*
Initial Developer: H2
Group
* Group
*/
*/
package
org
.
h2
.
index
;
package
org
.
h2
.
index
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
...
@@ -110,7 +111,8 @@ public class IndexCondition {
...
@@ -110,7 +111,8 @@ public class IndexCondition {
*/
*/
public
static
IndexCondition
getInList
(
ExpressionColumn
column
,
public
static
IndexCondition
getInList
(
ExpressionColumn
column
,
List
<
Expression
>
list
)
{
List
<
Expression
>
list
)
{
IndexCondition
cond
=
new
IndexCondition
(
Comparison
.
IN_LIST
,
column
,
null
);
IndexCondition
cond
=
new
IndexCondition
(
Comparison
.
IN_LIST
,
column
,
null
);
cond
.
expressionList
=
list
;
cond
.
expressionList
=
list
;
return
cond
;
return
cond
;
}
}
...
@@ -124,7 +126,8 @@ public class IndexCondition {
...
@@ -124,7 +126,8 @@ public class IndexCondition {
* @return the index condition
* @return the index condition
*/
*/
public
static
IndexCondition
getInQuery
(
ExpressionColumn
column
,
Query
query
)
{
public
static
IndexCondition
getInQuery
(
ExpressionColumn
column
,
Query
query
)
{
IndexCondition
cond
=
new
IndexCondition
(
Comparison
.
IN_QUERY
,
column
,
null
);
IndexCondition
cond
=
new
IndexCondition
(
Comparison
.
IN_QUERY
,
column
,
null
);
cond
.
expressionQuery
=
query
;
cond
.
expressionQuery
=
query
;
return
cond
;
return
cond
;
}
}
...
@@ -186,7 +189,7 @@ public class IndexCondition {
...
@@ -186,7 +189,7 @@ public class IndexCondition {
}
}
StatementBuilder
buff
=
new
StatementBuilder
();
StatementBuilder
buff
=
new
StatementBuilder
();
buff
.
append
(
column
.
getSQL
());
buff
.
append
(
column
.
getSQL
());
switch
(
compareType
)
{
switch
(
compareType
)
{
case
Comparison
.
EQUAL
:
case
Comparison
.
EQUAL
:
buff
.
append
(
" = "
);
buff
.
append
(
" = "
);
break
;
break
;
...
@@ -222,7 +225,7 @@ public class IndexCondition {
...
@@ -222,7 +225,7 @@ public class IndexCondition {
buff
.
append
(
" && "
);
buff
.
append
(
" && "
);
break
;
break
;
default
:
default
:
DbException
.
throwInternalError
(
"type="
+
compareType
);
DbException
.
throwInternalError
(
"type="
+
compareType
);
}
}
if
(
expression
!=
null
)
{
if
(
expression
!=
null
)
{
buff
.
append
(
expression
.
getSQL
());
buff
.
append
(
expression
.
getSQL
());
...
@@ -335,8 +338,7 @@ public class IndexCondition {
...
@@ -335,8 +338,7 @@ public class IndexCondition {
/**
/**
* Check if this index condition is of the type equality.
* Check if this index condition is of the type equality.
*
*
* @param constantExpression if the inner node
* @param constantExpression if the inner node is a constant expression
* is a constant expression
* @return true if this is a equality condition
* @return true if this is a equality condition
*/
*/
public
boolean
isEquality
(
boolean
constantExpression
)
{
public
boolean
isEquality
(
boolean
constantExpression
)
{
...
@@ -369,7 +371,8 @@ public class IndexCondition {
...
@@ -369,7 +371,8 @@ public class IndexCondition {
*/
*/
public
boolean
isEvaluatable
()
{
public
boolean
isEvaluatable
()
{
if
(
expression
!=
null
)
{
if
(
expression
!=
null
)
{
return
expression
.
isEverything
(
ExpressionVisitor
.
EVALUATABLE_VISITOR
);
return
expression
.
isEverything
(
ExpressionVisitor
.
EVALUATABLE_VISITOR
);
}
}
if
(
expressionList
!=
null
)
{
if
(
expressionList
!=
null
)
{
for
(
Expression
e
:
expressionList
)
{
for
(
Expression
e
:
expressionList
)
{
...
@@ -379,7 +382,43 @@ public class IndexCondition {
...
@@ -379,7 +382,43 @@ public class IndexCondition {
}
}
return
true
;
return
true
;
}
}
return
expressionQuery
.
isEverything
(
ExpressionVisitor
.
EVALUATABLE_VISITOR
);
return
expressionQuery
.
isEverything
(
ExpressionVisitor
.
EVALUATABLE_VISITOR
);
}
/**
* for display in the debugger
*/
public
String
toString
()
{
return
"column="
+
column
+
", compareType="
+
compareTypeToString
(
compareType
)
+
", expression="
+
expression
+
", expressionList="
+
expressionList
.
toString
()
+
", expressionQuery="
+
expressionQuery
;
}
private
static
String
compareTypeToString
(
int
i
)
{
StatementBuilder
s
=
new
StatementBuilder
();
if
((
i
&
EQUALITY
)
==
EQUALITY
)
{
s
.
appendExceptFirst
(
"&"
);
s
.
append
(
"EQUALITY"
);
}
if
((
i
&
START
)
==
START
)
{
s
.
appendExceptFirst
(
"&"
);
s
.
append
(
"START"
);
}
if
((
i
&
END
)
==
END
)
{
s
.
appendExceptFirst
(
"&"
);
s
.
append
(
"END"
);
}
if
((
i
&
ALWAYS_FALSE
)
==
ALWAYS_FALSE
)
{
s
.
appendExceptFirst
(
"&"
);
s
.
append
(
"ALWAYS_FALSE"
);
}
if
((
i
&
SPATIAL_INTERSECTS
)
==
SPATIAL_INTERSECTS
)
{
s
.
appendExceptFirst
(
"&"
);
s
.
append
(
"SPATIAL_INTERSECTS"
);
}
return
s
.
toString
();
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论