Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c59e4336
提交
c59e4336
authored
3月 18, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TRUE and FALSE constants are not cleared anyway
上级
7703a00a
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
34 行增加
和
30 行删除
+34
-30
Parser.java
h2/src/main/org/h2/command/Parser.java
+4
-4
ConditionAndOr.java
h2/src/main/org/h2/expression/ConditionAndOr.java
+2
-2
ConditionInSelect.java
h2/src/main/org/h2/expression/ConditionInSelect.java
+3
-3
ExpressionColumn.java
h2/src/main/org/h2/expression/ExpressionColumn.java
+2
-2
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-2
Parameter.java
h2/src/main/org/h2/expression/Parameter.java
+1
-1
ValueExpression.java
h2/src/main/org/h2/expression/ValueExpression.java
+1
-1
ValueDataType.java
h2/src/main/org/h2/mvstore/db/ValueDataType.java
+2
-2
Data.java
h2/src/main/org/h2/store/Data.java
+2
-2
Value.java
h2/src/main/org/h2/value/Value.java
+2
-2
ValueBoolean.java
h2/src/main/org/h2/value/ValueBoolean.java
+9
-5
TestDataPage.java
h2/src/test/org/h2/test/unit/TestDataPage.java
+3
-3
TestValueMemory.java
h2/src/test/org/h2/test/unit/TestValueMemory.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
c59e4336
...
@@ -2443,7 +2443,7 @@ public class Parser {
...
@@ -2443,7 +2443,7 @@ public class Parser {
if
(
database
.
getMode
().
prohibitEmptyInPredicate
)
{
if
(
database
.
getMode
().
prohibitEmptyInPredicate
)
{
throw
getSyntaxError
();
throw
getSyntaxError
();
}
}
r
=
ValueExpression
.
get
(
ValueBoolean
.
get
(
false
)
);
r
=
ValueExpression
.
get
(
ValueBoolean
.
FALSE
);
}
else
{
}
else
{
if
(
isSelect
())
{
if
(
isSelect
())
{
Query
query
=
parseSelect
();
Query
query
=
parseSelect
();
...
@@ -2533,7 +2533,7 @@ public class Parser {
...
@@ -2533,7 +2533,7 @@ public class Parser {
}
else
{
}
else
{
rightFilter
.
mapAndAddFilter
(
r
);
rightFilter
.
mapAndAddFilter
(
r
);
}
}
r
=
ValueExpression
.
get
(
ValueBoolean
.
get
(
true
)
);
r
=
ValueExpression
.
get
(
ValueBoolean
.
TRUE
);
}
}
}
}
}
else
{
}
else
{
...
@@ -3280,11 +3280,11 @@ public class Parser {
...
@@ -3280,11 +3280,11 @@ public class Parser {
break
;
break
;
case
TRUE:
case
TRUE:
read
();
read
();
r
=
ValueExpression
.
get
(
ValueBoolean
.
get
(
true
)
);
r
=
ValueExpression
.
get
(
ValueBoolean
.
TRUE
);
break
;
break
;
case
FALSE:
case
FALSE:
read
();
read
();
r
=
ValueExpression
.
get
(
ValueBoolean
.
get
(
false
)
);
r
=
ValueExpression
.
get
(
ValueBoolean
.
FALSE
);
break
;
break
;
case
ROWNUM:
case
ROWNUM:
read
();
read
();
...
...
h2/src/main/org/h2/expression/ConditionAndOr.java
浏览文件 @
c59e4336
...
@@ -100,7 +100,7 @@ public class ConditionAndOr extends Condition {
...
@@ -100,7 +100,7 @@ public class ConditionAndOr extends Condition {
if
(
r
==
ValueNull
.
INSTANCE
)
{
if
(
r
==
ValueNull
.
INSTANCE
)
{
return
r
;
return
r
;
}
}
return
ValueBoolean
.
get
(
true
)
;
return
ValueBoolean
.
TRUE
;
}
}
case
OR:
{
case
OR:
{
if
(
l
.
getBoolean
())
{
if
(
l
.
getBoolean
())
{
...
@@ -116,7 +116,7 @@ public class ConditionAndOr extends Condition {
...
@@ -116,7 +116,7 @@ public class ConditionAndOr extends Condition {
if
(
r
==
ValueNull
.
INSTANCE
)
{
if
(
r
==
ValueNull
.
INSTANCE
)
{
return
r
;
return
r
;
}
}
return
ValueBoolean
.
get
(
false
)
;
return
ValueBoolean
.
FALSE
;
}
}
default
:
default
:
throw
DbException
.
throwInternalError
(
"type="
+
andOrType
);
throw
DbException
.
throwInternalError
(
"type="
+
andOrType
);
...
...
h2/src/main/org/h2/expression/ConditionInSelect.java
浏览文件 @
c59e4336
...
@@ -62,16 +62,16 @@ public class ConditionInSelect extends Condition {
...
@@ -62,16 +62,16 @@ public class ConditionInSelect extends Condition {
}
}
int
dataType
=
rows
.
getColumnType
(
0
);
int
dataType
=
rows
.
getColumnType
(
0
);
if
(
dataType
==
Value
.
NULL
)
{
if
(
dataType
==
Value
.
NULL
)
{
return
ValueBoolean
.
get
(
false
)
;
return
ValueBoolean
.
FALSE
;
}
}
l
=
l
.
convertTo
(
dataType
);
l
=
l
.
convertTo
(
dataType
);
if
(
rows
.
containsDistinct
(
new
Value
[]
{
l
}))
{
if
(
rows
.
containsDistinct
(
new
Value
[]
{
l
}))
{
return
ValueBoolean
.
get
(
true
)
;
return
ValueBoolean
.
TRUE
;
}
}
if
(
rows
.
containsDistinct
(
new
Value
[]
{
ValueNull
.
INSTANCE
}))
{
if
(
rows
.
containsDistinct
(
new
Value
[]
{
ValueNull
.
INSTANCE
}))
{
return
ValueNull
.
INSTANCE
;
return
ValueNull
.
INSTANCE
;
}
}
return
ValueBoolean
.
get
(
false
)
;
return
ValueBoolean
.
FALSE
;
}
}
private
Value
getValueSlow
(
ResultInterface
rows
,
Value
l
)
{
private
Value
getValueSlow
(
ResultInterface
rows
,
Value
l
)
{
...
...
h2/src/main/org/h2/expression/ExpressionColumn.java
浏览文件 @
c59e4336
...
@@ -330,7 +330,7 @@ public class ExpressionColumn extends Expression {
...
@@ -330,7 +330,7 @@ public class ExpressionColumn extends Expression {
if
(
filter
==
tf
&&
column
.
getType
()
==
Value
.
BOOLEAN
)
{
if
(
filter
==
tf
&&
column
.
getType
()
==
Value
.
BOOLEAN
)
{
IndexCondition
cond
=
IndexCondition
.
get
(
IndexCondition
cond
=
IndexCondition
.
get
(
Comparison
.
EQUAL
,
this
,
ValueExpression
.
get
(
Comparison
.
EQUAL
,
this
,
ValueExpression
.
get
(
ValueBoolean
.
get
(
true
)
));
ValueBoolean
.
TRUE
));
filter
.
addIndexCondition
(
cond
);
filter
.
addIndexCondition
(
cond
);
}
}
}
}
...
@@ -338,7 +338,7 @@ public class ExpressionColumn extends Expression {
...
@@ -338,7 +338,7 @@ public class ExpressionColumn extends Expression {
@Override
@Override
public
Expression
getNotIfPossible
(
Session
session
)
{
public
Expression
getNotIfPossible
(
Session
session
)
{
return
new
Comparison
(
session
,
Comparison
.
EQUAL
,
this
,
return
new
Comparison
(
session
,
Comparison
.
EQUAL
,
this
,
ValueExpression
.
get
(
ValueBoolean
.
get
(
false
)
));
ValueExpression
.
get
(
ValueBoolean
.
FALSE
));
}
}
}
}
h2/src/main/org/h2/expression/Function.java
浏览文件 @
c59e4336
...
@@ -1048,13 +1048,13 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1048,13 +1048,13 @@ public class Function extends Expression implements FunctionCall {
break
;
break
;
}
}
case
ARRAY_CONTAINS:
{
case
ARRAY_CONTAINS:
{
result
=
ValueBoolean
.
get
(
false
)
;
result
=
ValueBoolean
.
FALSE
;
if
(
v0
.
getType
()
==
Value
.
ARRAY
)
{
if
(
v0
.
getType
()
==
Value
.
ARRAY
)
{
Value
v1
=
getNullOrValue
(
session
,
args
,
values
,
1
);
Value
v1
=
getNullOrValue
(
session
,
args
,
values
,
1
);
Value
[]
list
=
((
ValueArray
)
v0
).
getList
();
Value
[]
list
=
((
ValueArray
)
v0
).
getList
();
for
(
Value
v
:
list
)
{
for
(
Value
v
:
list
)
{
if
(
v
.
equals
(
v1
))
{
if
(
v
.
equals
(
v1
))
{
result
=
ValueBoolean
.
get
(
true
)
;
result
=
ValueBoolean
.
TRUE
;
break
;
break
;
}
}
}
}
...
...
h2/src/main/org/h2/expression/Parameter.java
浏览文件 @
c59e4336
...
@@ -176,7 +176,7 @@ public class Parameter extends Expression implements ParameterInterface {
...
@@ -176,7 +176,7 @@ public class Parameter extends Expression implements ParameterInterface {
@Override
@Override
public
Expression
getNotIfPossible
(
Session
session
)
{
public
Expression
getNotIfPossible
(
Session
session
)
{
return
new
Comparison
(
session
,
Comparison
.
EQUAL
,
this
,
return
new
Comparison
(
session
,
Comparison
.
EQUAL
,
this
,
ValueExpression
.
get
(
ValueBoolean
.
get
(
false
)
));
ValueExpression
.
get
(
ValueBoolean
.
FALSE
));
}
}
public
void
setColumn
(
Column
column
)
{
public
void
setColumn
(
Column
column
)
{
...
...
h2/src/main/org/h2/expression/ValueExpression.java
浏览文件 @
c59e4336
...
@@ -91,7 +91,7 @@ public class ValueExpression extends Expression {
...
@@ -91,7 +91,7 @@ public class ValueExpression extends Expression {
@Override
@Override
public
Expression
getNotIfPossible
(
Session
session
)
{
public
Expression
getNotIfPossible
(
Session
session
)
{
return
new
Comparison
(
session
,
Comparison
.
EQUAL
,
this
,
return
new
Comparison
(
session
,
Comparison
.
EQUAL
,
this
,
ValueExpression
.
get
(
ValueBoolean
.
get
(
false
)
));
ValueExpression
.
get
(
ValueBoolean
.
FALSE
));
}
}
@Override
@Override
...
...
h2/src/main/org/h2/mvstore/db/ValueDataType.java
浏览文件 @
c59e4336
...
@@ -459,9 +459,9 @@ public class ValueDataType implements DataType {
...
@@ -459,9 +459,9 @@ public class ValueDataType implements DataType {
case
Value
.
NULL
:
case
Value
.
NULL
:
return
ValueNull
.
INSTANCE
;
return
ValueNull
.
INSTANCE
;
case
BOOLEAN_TRUE:
case
BOOLEAN_TRUE:
return
ValueBoolean
.
get
(
true
)
;
return
ValueBoolean
.
TRUE
;
case
BOOLEAN_FALSE:
case
BOOLEAN_FALSE:
return
ValueBoolean
.
get
(
false
)
;
return
ValueBoolean
.
FALSE
;
case
INT_NEG:
case
INT_NEG:
return
ValueInt
.
get
(-
readVarInt
(
buff
));
return
ValueInt
.
get
(-
readVarInt
(
buff
));
case
Value
.
ENUM
:
case
Value
.
ENUM
:
...
...
h2/src/main/org/h2/store/Data.java
浏览文件 @
c59e4336
...
@@ -716,9 +716,9 @@ public class Data {
...
@@ -716,9 +716,9 @@ public class Data {
case
Value
.
NULL
:
case
Value
.
NULL
:
return
ValueNull
.
INSTANCE
;
return
ValueNull
.
INSTANCE
;
case
BOOLEAN_TRUE:
case
BOOLEAN_TRUE:
return
ValueBoolean
.
get
(
true
)
;
return
ValueBoolean
.
TRUE
;
case
BOOLEAN_FALSE:
case
BOOLEAN_FALSE:
return
ValueBoolean
.
get
(
false
)
;
return
ValueBoolean
.
FALSE
;
case
INT_NEG:
case
INT_NEG:
return
ValueInt
.
get
(-
readVarInt
());
return
ValueInt
.
get
(-
readVarInt
());
case
Value
.
ENUM
:
case
Value
.
ENUM
:
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
c59e4336
...
@@ -1042,12 +1042,12 @@ public abstract class Value {
...
@@ -1042,12 +1042,12 @@ public abstract class Value {
s
.
equalsIgnoreCase
(
"t"
)
||
s
.
equalsIgnoreCase
(
"t"
)
||
s
.
equalsIgnoreCase
(
"yes"
)
||
s
.
equalsIgnoreCase
(
"yes"
)
||
s
.
equalsIgnoreCase
(
"y"
))
{
s
.
equalsIgnoreCase
(
"y"
))
{
return
ValueBoolean
.
get
(
true
)
;
return
ValueBoolean
.
TRUE
;
}
else
if
(
s
.
equalsIgnoreCase
(
"false"
)
||
}
else
if
(
s
.
equalsIgnoreCase
(
"false"
)
||
s
.
equalsIgnoreCase
(
"f"
)
||
s
.
equalsIgnoreCase
(
"f"
)
||
s
.
equalsIgnoreCase
(
"no"
)
||
s
.
equalsIgnoreCase
(
"no"
)
||
s
.
equalsIgnoreCase
(
"n"
))
{
s
.
equalsIgnoreCase
(
"n"
))
{
return
ValueBoolean
.
get
(
false
)
;
return
ValueBoolean
.
FALSE
;
}
else
{
}
else
{
// convert to a number, and if it is not 0 then it is true
// convert to a number, and if it is not 0 then it is true
return
ValueBoolean
.
get
(
new
BigDecimal
(
s
).
signum
()
!=
0
);
return
ValueBoolean
.
get
(
new
BigDecimal
(
s
).
signum
()
!=
0
);
...
...
h2/src/main/org/h2/value/ValueBoolean.java
浏览文件 @
c59e4336
...
@@ -25,10 +25,14 @@ public class ValueBoolean extends Value {
...
@@ -25,10 +25,14 @@ public class ValueBoolean extends Value {
public
static
final
int
DISPLAY_SIZE
=
5
;
public
static
final
int
DISPLAY_SIZE
=
5
;
/**
/**
*
Of type Object so that Tomcat doesn't set it to null
.
*
TRUE value
.
*/
*/
private
static
final
Object
TRUE
=
new
ValueBoolean
(
true
);
public
static
final
ValueBoolean
TRUE
=
new
ValueBoolean
(
true
);
private
static
final
Object
FALSE
=
new
ValueBoolean
(
false
);
/**
* FALSE value.
*/
public
static
final
ValueBoolean
FALSE
=
new
ValueBoolean
(
false
);
private
final
boolean
value
;
private
final
boolean
value
;
...
@@ -53,7 +57,7 @@ public class ValueBoolean extends Value {
...
@@ -53,7 +57,7 @@ public class ValueBoolean extends Value {
@Override
@Override
public
Value
negate
()
{
public
Value
negate
()
{
return
(
ValueBoolean
)
(
value
?
FALSE
:
TRUE
)
;
return
value
?
FALSE
:
TRUE
;
}
}
@Override
@Override
...
@@ -95,7 +99,7 @@ public class ValueBoolean extends Value {
...
@@ -95,7 +99,7 @@ public class ValueBoolean extends Value {
* @return the value
* @return the value
*/
*/
public
static
ValueBoolean
get
(
boolean
b
)
{
public
static
ValueBoolean
get
(
boolean
b
)
{
return
(
ValueBoolean
)
(
b
?
TRUE
:
FALSE
)
;
return
b
?
TRUE
:
FALSE
;
}
}
@Override
@Override
...
...
h2/src/test/org/h2/test/unit/TestDataPage.java
浏览文件 @
c59e4336
...
@@ -126,8 +126,8 @@ public class TestDataPage extends TestBase implements DataHandler {
...
@@ -126,8 +126,8 @@ public class TestDataPage extends TestBase implements DataHandler {
private
void
testValues
()
{
private
void
testValues
()
{
testValue
(
ValueNull
.
INSTANCE
);
testValue
(
ValueNull
.
INSTANCE
);
testValue
(
ValueBoolean
.
get
(
false
)
);
testValue
(
ValueBoolean
.
FALSE
);
testValue
(
ValueBoolean
.
get
(
true
)
);
testValue
(
ValueBoolean
.
TRUE
);
for
(
int
i
=
0
;
i
<
256
;
i
++)
{
for
(
int
i
=
0
;
i
<
256
;
i
++)
{
testValue
(
ValueByte
.
get
((
byte
)
i
));
testValue
(
ValueByte
.
get
((
byte
)
i
));
}
}
...
@@ -205,7 +205,7 @@ public class TestDataPage extends TestBase implements DataHandler {
...
@@ -205,7 +205,7 @@ public class TestDataPage extends TestBase implements DataHandler {
}
}
}
}
testValue
(
ValueArray
.
get
(
new
Value
[
0
]));
testValue
(
ValueArray
.
get
(
new
Value
[
0
]));
testValue
(
ValueArray
.
get
(
new
Value
[]
{
ValueBoolean
.
get
(
true
)
,
testValue
(
ValueArray
.
get
(
new
Value
[]
{
ValueBoolean
.
TRUE
,
ValueInt
.
get
(
10
)
}));
ValueInt
.
get
(
10
)
}));
SimpleResultSet
rs
=
new
SimpleResultSet
();
SimpleResultSet
rs
=
new
SimpleResultSet
();
...
...
h2/src/test/org/h2/test/unit/TestValueMemory.java
浏览文件 @
c59e4336
...
@@ -151,7 +151,7 @@ public class TestValueMemory extends TestBase implements DataHandler {
...
@@ -151,7 +151,7 @@ public class TestValueMemory extends TestBase implements DataHandler {
case
Value
.
NULL
:
case
Value
.
NULL
:
return
ValueNull
.
INSTANCE
;
return
ValueNull
.
INSTANCE
;
case
Value
.
BOOLEAN
:
case
Value
.
BOOLEAN
:
return
ValueBoolean
.
get
(
false
)
;
return
ValueBoolean
.
FALSE
;
case
Value
.
BYTE
:
case
Value
.
BYTE
:
return
ValueByte
.
get
((
byte
)
random
.
nextInt
());
return
ValueByte
.
get
((
byte
)
random
.
nextInt
());
case
Value
.
SHORT
:
case
Value
.
SHORT
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论