Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6bb90ad6
Unverified
提交
6bb90ad6
authored
1月 20, 2018
作者:
Noel Grandin
提交者:
GitHub
1月 20, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #793 from katzyn/boolean
Change return type of Value.getBoolean() to boolean (unwrapped)
上级
b8253732
374f6ab5
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
58 行增加
和
79 行删除
+58
-79
Parser.java
h2/src/main/org/h2/command/Parser.java
+1
-1
Delete.java
h2/src/main/org/h2/command/dml/Delete.java
+1
-2
Select.java
h2/src/main/org/h2/command/dml/Select.java
+2
-9
Update.java
h2/src/main/org/h2/command/dml/Update.java
+1
-2
ConstraintCheck.java
h2/src/main/org/h2/constraint/ConstraintCheck.java
+7
-4
AggregateDataDefault.java
h2/src/main/org/h2/expression/AggregateDataDefault.java
+2
-4
ConditionAndOr.java
h2/src/main/org/h2/expression/ConditionAndOr.java
+12
-12
Expression.java
h2/src/main/org/h2/expression/Expression.java
+2
-2
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-4
ValueExpression.java
h2/src/main/org/h2/expression/ValueExpression.java
+1
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+1
-3
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+2
-4
ValueDataType.java
h2/src/main/org/h2/mvstore/db/ValueDataType.java
+1
-2
Data.java
h2/src/main/org/h2/store/Data.java
+1
-2
Column.java
h2/src/main/org/h2/table/Column.java
+1
-1
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+1
-4
Transfer.java
h2/src/main/org/h2/value/Transfer.java
+1
-1
Value.java
h2/src/main/org/h2/value/Value.java
+8
-9
ValueBoolean.java
h2/src/main/org/h2/value/ValueBoolean.java
+9
-10
ValueNull.java
h2/src/main/org/h2/value/ValueNull.java
+2
-2
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
6bb90ad6
...
@@ -3390,7 +3390,7 @@ public class Parser {
...
@@ -3390,7 +3390,7 @@ public class Parser {
private
boolean
readBooleanSetting
()
{
private
boolean
readBooleanSetting
()
{
if
(
currentTokenType
==
VALUE
)
{
if
(
currentTokenType
==
VALUE
)
{
boolean
result
=
currentValue
.
getBoolean
()
.
booleanValue
()
;
boolean
result
=
currentValue
.
getBoolean
();
read
();
read
();
return
result
;
return
result
;
}
}
...
...
h2/src/main/org/h2/command/dml/Delete.java
浏览文件 @
6bb90ad6
...
@@ -78,8 +78,7 @@ public class Delete extends Prepared {
...
@@ -78,8 +78,7 @@ public class Delete extends Prepared {
int
count
=
0
;
int
count
=
0
;
while
(
limitRows
!=
0
&&
targetTableFilter
.
next
())
{
while
(
limitRows
!=
0
&&
targetTableFilter
.
next
())
{
setCurrentRowNumber
(
rows
.
size
()
+
1
);
setCurrentRowNumber
(
rows
.
size
()
+
1
);
if
(
condition
==
null
||
Boolean
.
TRUE
.
equals
(
if
(
condition
==
null
||
condition
.
getBooleanValue
(
session
))
{
condition
.
getBooleanValue
(
session
)))
{
Row
row
=
targetTableFilter
.
get
();
Row
row
=
targetTableFilter
.
get
();
boolean
done
=
false
;
boolean
done
=
false
;
if
(
table
.
fireRow
())
{
if
(
table
.
fireRow
())
{
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
6bb90ad6
...
@@ -195,13 +195,7 @@ public class Select extends Query {
...
@@ -195,13 +195,7 @@ public class Select extends Query {
private
boolean
isHavingNullOrFalse
(
Value
[]
row
)
{
private
boolean
isHavingNullOrFalse
(
Value
[]
row
)
{
if
(
havingIndex
>=
0
)
{
if
(
havingIndex
>=
0
)
{
Value
v
=
row
[
havingIndex
];
return
!
row
[
havingIndex
].
getBoolean
();
if
(
v
==
ValueNull
.
INSTANCE
)
{
return
true
;
}
if
(!
Boolean
.
TRUE
.
equals
(
v
.
getBoolean
()))
{
return
true
;
}
}
}
return
false
;
return
false
;
}
}
...
@@ -281,8 +275,7 @@ public class Select extends Query {
...
@@ -281,8 +275,7 @@ public class Select extends Query {
}
}
boolean
isConditionMet
()
{
boolean
isConditionMet
()
{
return
condition
==
null
||
return
condition
==
null
||
condition
.
getBooleanValue
(
session
);
Boolean
.
TRUE
.
equals
(
condition
.
getBooleanValue
(
session
));
}
}
private
void
queryGroup
(
int
columnCount
,
LocalResult
result
)
{
private
void
queryGroup
(
int
columnCount
,
LocalResult
result
)
{
...
...
h2/src/main/org/h2/command/dml/Update.java
浏览文件 @
6bb90ad6
...
@@ -112,8 +112,7 @@ public class Update extends Prepared {
...
@@ -112,8 +112,7 @@ public class Update extends Prepared {
if
(
limitRows
>=
0
&&
count
>=
limitRows
)
{
if
(
limitRows
>=
0
&&
count
>=
limitRows
)
{
break
;
break
;
}
}
if
(
condition
==
null
||
if
(
condition
==
null
||
condition
.
getBooleanValue
(
session
))
{
Boolean
.
TRUE
.
equals
(
condition
.
getBooleanValue
(
session
)))
{
Row
oldRow
=
targetTableFilter
.
get
();
Row
oldRow
=
targetTableFilter
.
get
();
Row
newRow
=
table
.
getTemplateRow
();
Row
newRow
=
table
.
getTemplateRow
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
...
...
h2/src/main/org/h2/constraint/ConstraintCheck.java
浏览文件 @
6bb90ad6
...
@@ -20,6 +20,8 @@ import org.h2.table.Column;
...
@@ -20,6 +20,8 @@ import org.h2.table.Column;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableFilter
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.value.Value
;
import
org.h2.value.ValueNull
;
/**
/**
* A check constraint.
* A check constraint.
...
@@ -92,15 +94,16 @@ public class ConstraintCheck extends Constraint {
...
@@ -92,15 +94,16 @@ public class ConstraintCheck extends Constraint {
return
;
return
;
}
}
filter
.
set
(
newRow
);
filter
.
set
(
newRow
);
B
oolean
b
;
b
oolean
b
;
try
{
try
{
b
=
expr
.
getValue
(
session
).
getBoolean
();
Value
v
=
expr
.
getValue
(
session
);
// Both TRUE and NULL are ok
b
=
v
==
ValueNull
.
INSTANCE
||
v
.
getBoolean
();
}
catch
(
DbException
ex
)
{
}
catch
(
DbException
ex
)
{
throw
DbException
.
get
(
ErrorCode
.
CHECK_CONSTRAINT_INVALID
,
ex
,
throw
DbException
.
get
(
ErrorCode
.
CHECK_CONSTRAINT_INVALID
,
ex
,
getShortDescription
());
getShortDescription
());
}
}
// Both TRUE and NULL are ok
if
(!
b
)
{
if
(
Boolean
.
FALSE
.
equals
(
b
))
{
throw
DbException
.
get
(
ErrorCode
.
CHECK_CONSTRAINT_VIOLATED_1
,
throw
DbException
.
get
(
ErrorCode
.
CHECK_CONSTRAINT_VIOLATED_1
,
getShortDescription
());
getShortDescription
());
}
}
...
...
h2/src/main/org/h2/expression/AggregateDataDefault.java
浏览文件 @
6bb90ad6
...
@@ -95,8 +95,7 @@ class AggregateDataDefault extends AggregateData {
...
@@ -95,8 +95,7 @@ class AggregateDataDefault extends AggregateData {
if
(
value
==
null
)
{
if
(
value
==
null
)
{
value
=
v
;
value
=
v
;
}
else
{
}
else
{
value
=
ValueBoolean
.
get
(
value
.
getBoolean
().
booleanValue
()
&&
value
=
ValueBoolean
.
get
(
value
.
getBoolean
()
&&
v
.
getBoolean
());
v
.
getBoolean
().
booleanValue
());
}
}
break
;
break
;
case
Aggregate
.
BOOL_OR
:
case
Aggregate
.
BOOL_OR
:
...
@@ -104,8 +103,7 @@ class AggregateDataDefault extends AggregateData {
...
@@ -104,8 +103,7 @@ class AggregateDataDefault extends AggregateData {
if
(
value
==
null
)
{
if
(
value
==
null
)
{
value
=
v
;
value
=
v
;
}
else
{
}
else
{
value
=
ValueBoolean
.
get
(
value
.
getBoolean
().
booleanValue
()
||
value
=
ValueBoolean
.
get
(
value
.
getBoolean
()
||
v
.
getBoolean
());
v
.
getBoolean
().
booleanValue
());
}
}
break
;
break
;
case
Aggregate
.
BIT_AND
:
case
Aggregate
.
BIT_AND
:
...
...
h2/src/main/org/h2/expression/ConditionAndOr.java
浏览文件 @
6bb90ad6
...
@@ -87,11 +87,11 @@ public class ConditionAndOr extends Condition {
...
@@ -87,11 +87,11 @@ public class ConditionAndOr extends Condition {
Value
r
;
Value
r
;
switch
(
andOrType
)
{
switch
(
andOrType
)
{
case
AND:
{
case
AND:
{
if
(
Boolean
.
FALSE
.
equals
(
l
.
getBoolean
()
))
{
if
(
l
!=
ValueNull
.
INSTANCE
&&
!
l
.
getBoolean
(
))
{
return
l
;
return
l
;
}
}
r
=
right
.
getValue
(
session
);
r
=
right
.
getValue
(
session
);
if
(
Boolean
.
FALSE
.
equals
(
r
.
getBoolean
()
))
{
if
(
r
!=
ValueNull
.
INSTANCE
&&
!
r
.
getBoolean
(
))
{
return
r
;
return
r
;
}
}
if
(
l
==
ValueNull
.
INSTANCE
)
{
if
(
l
==
ValueNull
.
INSTANCE
)
{
...
@@ -103,11 +103,11 @@ public class ConditionAndOr extends Condition {
...
@@ -103,11 +103,11 @@ public class ConditionAndOr extends Condition {
return
ValueBoolean
.
get
(
true
);
return
ValueBoolean
.
get
(
true
);
}
}
case
OR:
{
case
OR:
{
if
(
Boolean
.
TRUE
.
equals
(
l
.
getBoolean
()
))
{
if
(
l
.
getBoolean
(
))
{
return
l
;
return
l
;
}
}
r
=
right
.
getValue
(
session
);
r
=
right
.
getValue
(
session
);
if
(
Boolean
.
TRUE
.
equals
(
r
.
getBoolean
()
))
{
if
(
r
.
getBoolean
(
))
{
return
r
;
return
r
;
}
}
if
(
l
==
ValueNull
.
INSTANCE
)
{
if
(
l
==
ValueNull
.
INSTANCE
)
{
...
@@ -212,30 +212,30 @@ public class ConditionAndOr extends Condition {
...
@@ -212,30 +212,30 @@ public class ConditionAndOr extends Condition {
switch
(
andOrType
)
{
switch
(
andOrType
)
{
case
AND:
case
AND:
if
(
l
!=
null
)
{
if
(
l
!=
null
)
{
if
(
Boolean
.
FALSE
.
equals
(
l
.
getBoolean
()
))
{
if
(
l
!=
ValueNull
.
INSTANCE
&&
!
l
.
getBoolean
(
))
{
return
ValueExpression
.
get
(
l
);
return
ValueExpression
.
get
(
l
);
}
else
if
(
Boolean
.
TRUE
.
equals
(
l
.
getBoolean
()
))
{
}
else
if
(
l
.
getBoolean
(
))
{
return
right
;
return
right
;
}
}
}
else
if
(
r
!=
null
)
{
}
else
if
(
r
!=
null
)
{
if
(
Boolean
.
FALSE
.
equals
(
r
.
getBoolean
()
))
{
if
(
r
!=
ValueNull
.
INSTANCE
&&
!
r
.
getBoolean
(
))
{
return
ValueExpression
.
get
(
r
);
return
ValueExpression
.
get
(
r
);
}
else
if
(
Boolean
.
TRUE
.
equals
(
r
.
getBoolean
()
))
{
}
else
if
(
r
.
getBoolean
(
))
{
return
left
;
return
left
;
}
}
}
}
break
;
break
;
case
OR:
case
OR:
if
(
l
!=
null
)
{
if
(
l
!=
null
)
{
if
(
Boolean
.
TRUE
.
equals
(
l
.
getBoolean
()
))
{
if
(
l
.
getBoolean
(
))
{
return
ValueExpression
.
get
(
l
);
return
ValueExpression
.
get
(
l
);
}
else
if
(
Boolean
.
FALSE
.
equals
(
l
.
getBoolean
())
)
{
}
else
if
(
l
!=
ValueNull
.
INSTANCE
)
{
return
right
;
return
right
;
}
}
}
else
if
(
r
!=
null
)
{
}
else
if
(
r
!=
null
)
{
if
(
Boolean
.
TRUE
.
equals
(
r
.
getBoolean
()
))
{
if
(
r
.
getBoolean
(
))
{
return
ValueExpression
.
get
(
r
);
return
ValueExpression
.
get
(
r
);
}
else
if
(
Boolean
.
FALSE
.
equals
(
r
.
getBoolean
())
)
{
}
else
if
(
r
!=
ValueNull
.
INSTANCE
)
{
return
left
;
return
left
;
}
}
}
}
...
...
h2/src/main/org/h2/expression/Expression.java
浏览文件 @
6bb90ad6
...
@@ -168,13 +168,13 @@ public abstract class Expression {
...
@@ -168,13 +168,13 @@ public abstract class Expression {
/**
/**
* Get the value in form of a boolean expression.
* Get the value in form of a boolean expression.
* Returns true
, false, or null
.
* Returns true
or false
.
* In this database, everything can be a condition.
* In this database, everything can be a condition.
*
*
* @param session the session
* @param session the session
* @return the result
* @return the result
*/
*/
public
B
oolean
getBooleanValue
(
Session
session
)
{
public
b
oolean
getBooleanValue
(
Session
session
)
{
return
getValue
(
session
).
getBoolean
();
return
getValue
(
session
).
getBoolean
();
}
}
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
6bb90ad6
...
@@ -989,8 +989,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -989,8 +989,7 @@ public class Function extends Expression implements FunctionCall {
}
}
case
CASEWHEN:
{
case
CASEWHEN:
{
Value
v
;
Value
v
;
if
(
v0
==
ValueNull
.
INSTANCE
||
if
(!
v0
.
getBoolean
())
{
!
v0
.
getBoolean
().
booleanValue
())
{
v
=
getNullOrValue
(
session
,
args
,
values
,
2
);
v
=
getNullOrValue
(
session
,
args
,
values
,
2
);
}
else
{
}
else
{
v
=
getNullOrValue
(
session
,
args
,
values
,
1
);
v
=
getNullOrValue
(
session
,
args
,
values
,
1
);
...
@@ -1067,8 +1066,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1067,8 +1066,7 @@ public class Function extends Expression implements FunctionCall {
// (null, when, then, when, then, else)
// (null, when, then, when, then, else)
for
(
int
i
=
1
,
len
=
args
.
length
-
1
;
i
<
len
;
i
+=
2
)
{
for
(
int
i
=
1
,
len
=
args
.
length
-
1
;
i
<
len
;
i
+=
2
)
{
Value
when
=
args
[
i
].
getValue
(
session
);
Value
when
=
args
[
i
].
getValue
(
session
);
if
(!(
when
==
ValueNull
.
INSTANCE
)
&&
if
(
when
.
getBoolean
())
{
when
.
getBoolean
().
booleanValue
())
{
then
=
args
[
i
+
1
];
then
=
args
[
i
+
1
];
break
;
break
;
}
}
...
...
h2/src/main/org/h2/expression/ValueExpression.java
浏览文件 @
6bb90ad6
...
@@ -81,7 +81,7 @@ public class ValueExpression extends Expression {
...
@@ -81,7 +81,7 @@ public class ValueExpression extends Expression {
@Override
@Override
public
void
createIndexConditions
(
Session
session
,
TableFilter
filter
)
{
public
void
createIndexConditions
(
Session
session
,
TableFilter
filter
)
{
if
(
value
.
getType
()
==
Value
.
BOOLEAN
)
{
if
(
value
.
getType
()
==
Value
.
BOOLEAN
)
{
boolean
v
=
((
ValueBoolean
)
value
).
getBoolean
()
.
booleanValue
()
;
boolean
v
=
((
ValueBoolean
)
value
).
getBoolean
();
if
(!
v
)
{
if
(!
v
)
{
filter
.
addIndexCondition
(
IndexCondition
.
get
(
Comparison
.
FALSE
,
null
,
this
));
filter
.
addIndexCondition
(
IndexCondition
.
get
(
Comparison
.
FALSE
,
null
,
this
));
}
}
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
6bb90ad6
...
@@ -586,9 +586,7 @@ public class JdbcConnection extends TraceObject
...
@@ -586,9 +586,7 @@ public class JdbcConnection extends TraceObject
getReadOnly
=
prepareCommand
(
"CALL READONLY()"
,
getReadOnly
);
getReadOnly
=
prepareCommand
(
"CALL READONLY()"
,
getReadOnly
);
ResultInterface
result
=
getReadOnly
.
executeQuery
(
0
,
false
);
ResultInterface
result
=
getReadOnly
.
executeQuery
(
0
,
false
);
result
.
next
();
result
.
next
();
boolean
readOnly
=
result
.
currentRow
()[
0
].
getBoolean
()
return
result
.
currentRow
()[
0
].
getBoolean
();
.
booleanValue
();
return
readOnly
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
6bb90ad6
...
@@ -548,8 +548,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
...
@@ -548,8 +548,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
boolean
getBoolean
(
int
columnIndex
)
throws
SQLException
{
public
boolean
getBoolean
(
int
columnIndex
)
throws
SQLException
{
try
{
try
{
debugCodeCall
(
"getBoolean"
,
columnIndex
);
debugCodeCall
(
"getBoolean"
,
columnIndex
);
Boolean
v
=
get
(
columnIndex
).
getBoolean
();
return
get
(
columnIndex
).
getBoolean
();
return
v
==
null
?
false
:
v
.
booleanValue
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
@@ -567,8 +566,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
...
@@ -567,8 +566,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
boolean
getBoolean
(
String
columnLabel
)
throws
SQLException
{
public
boolean
getBoolean
(
String
columnLabel
)
throws
SQLException
{
try
{
try
{
debugCodeCall
(
"getBoolean"
,
columnLabel
);
debugCodeCall
(
"getBoolean"
,
columnLabel
);
Boolean
v
=
get
(
columnLabel
).
getBoolean
();
return
get
(
columnLabel
).
getBoolean
();
return
v
==
null
?
false
:
v
.
booleanValue
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
...
h2/src/main/org/h2/mvstore/db/ValueDataType.java
浏览文件 @
6bb90ad6
...
@@ -192,8 +192,7 @@ public class ValueDataType implements DataType {
...
@@ -192,8 +192,7 @@ public class ValueDataType implements DataType {
int
type
=
v
.
getType
();
int
type
=
v
.
getType
();
switch
(
type
)
{
switch
(
type
)
{
case
Value
.
BOOLEAN
:
case
Value
.
BOOLEAN
:
buff
.
put
((
byte
)
(
v
.
getBoolean
().
booleanValue
()
?
buff
.
put
((
byte
)
(
v
.
getBoolean
()
?
BOOLEAN_TRUE
:
BOOLEAN_FALSE
));
BOOLEAN_TRUE
:
BOOLEAN_FALSE
));
break
;
break
;
case
Value
.
BYTE
:
case
Value
.
BYTE
:
buff
.
put
((
byte
)
type
).
put
(
v
.
getByte
());
buff
.
put
((
byte
)
type
).
put
(
v
.
getByte
());
...
...
h2/src/main/org/h2/store/Data.java
浏览文件 @
6bb90ad6
...
@@ -418,8 +418,7 @@ public class Data {
...
@@ -418,8 +418,7 @@ public class Data {
int
type
=
v
.
getType
();
int
type
=
v
.
getType
();
switch
(
type
)
{
switch
(
type
)
{
case
Value
.
BOOLEAN
:
case
Value
.
BOOLEAN
:
writeByte
((
byte
)
(
v
.
getBoolean
().
booleanValue
()
?
writeByte
((
byte
)
(
v
.
getBoolean
()
?
BOOLEAN_TRUE
:
BOOLEAN_FALSE
));
BOOLEAN_TRUE
:
BOOLEAN_FALSE
));
break
;
break
;
case
Value
.
BYTE
:
case
Value
.
BYTE
:
writeByte
((
byte
)
type
);
writeByte
((
byte
)
type
);
...
...
h2/src/main/org/h2/table/Column.java
浏览文件 @
6bb90ad6
...
@@ -362,7 +362,7 @@ public class Column {
...
@@ -362,7 +362,7 @@ public class Column {
v
=
checkConstraint
.
getValue
(
session
);
v
=
checkConstraint
.
getValue
(
session
);
}
}
// Both TRUE and NULL are ok
// Both TRUE and NULL are ok
if
(
Boolean
.
FALSE
.
equals
(
v
.
getBoolean
()
))
{
if
(
v
!=
ValueNull
.
INSTANCE
&&
!
v
.
getBoolean
(
))
{
throw
DbException
.
get
(
throw
DbException
.
get
(
ErrorCode
.
CHECK_CONSTRAINT_VIOLATED_1
,
ErrorCode
.
CHECK_CONSTRAINT_VIOLATED_1
,
checkConstraint
.
getSQL
());
checkConstraint
.
getSQL
());
...
...
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
6bb90ad6
...
@@ -577,10 +577,7 @@ public class TableFilter implements ColumnResolver {
...
@@ -577,10 +577,7 @@ public class TableFilter implements ColumnResolver {
* @return true if yes
* @return true if yes
*/
*/
boolean
isOk
(
Expression
condition
)
{
boolean
isOk
(
Expression
condition
)
{
if
(
condition
==
null
)
{
return
condition
==
null
||
condition
.
getBooleanValue
(
session
);
return
true
;
}
return
Boolean
.
TRUE
.
equals
(
condition
.
getBooleanValue
(
session
));
}
}
/**
/**
...
...
h2/src/main/org/h2/value/Transfer.java
浏览文件 @
6bb90ad6
...
@@ -342,7 +342,7 @@ public class Transfer {
...
@@ -342,7 +342,7 @@ public class Transfer {
break
;
break
;
}
}
case
Value
.
BOOLEAN
:
case
Value
.
BOOLEAN
:
writeBoolean
(
v
.
getBoolean
()
.
booleanValue
()
);
writeBoolean
(
v
.
getBoolean
());
break
;
break
;
case
Value
.
BYTE
:
case
Value
.
BYTE
:
writeByte
(
v
.
getByte
());
writeByte
(
v
.
getByte
());
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
6bb90ad6
...
@@ -423,7 +423,7 @@ public abstract class Value {
...
@@ -423,7 +423,7 @@ public abstract class Value {
softCache
=
null
;
softCache
=
null
;
}
}
public
B
oolean
getBoolean
()
{
public
b
oolean
getBoolean
()
{
return
((
ValueBoolean
)
convertTo
(
Value
.
BOOLEAN
)).
getBoolean
();
return
((
ValueBoolean
)
convertTo
(
Value
.
BOOLEAN
)).
getBoolean
();
}
}
...
@@ -630,7 +630,7 @@ public abstract class Value {
...
@@ -630,7 +630,7 @@ public abstract class Value {
case
BYTE:
{
case
BYTE:
{
switch
(
getType
())
{
switch
(
getType
())
{
case
BOOLEAN:
case
BOOLEAN:
return
ValueByte
.
get
(
getBoolean
()
.
booleanValue
()
?
(
byte
)
1
:
(
byte
)
0
);
return
ValueByte
.
get
(
getBoolean
()
?
(
byte
)
1
:
(
byte
)
0
);
case
SHORT:
case
SHORT:
return
ValueByte
.
get
(
convertToByte
(
getShort
(),
column
));
return
ValueByte
.
get
(
convertToByte
(
getShort
(),
column
));
case
ENUM:
case
ENUM:
...
@@ -655,7 +655,7 @@ public abstract class Value {
...
@@ -655,7 +655,7 @@ public abstract class Value {
case
SHORT:
{
case
SHORT:
{
switch
(
getType
())
{
switch
(
getType
())
{
case
BOOLEAN:
case
BOOLEAN:
return
ValueShort
.
get
(
getBoolean
()
.
booleanValue
()
?
(
short
)
1
:
(
short
)
0
);
return
ValueShort
.
get
(
getBoolean
()
?
(
short
)
1
:
(
short
)
0
);
case
BYTE:
case
BYTE:
return
ValueShort
.
get
(
getByte
());
return
ValueShort
.
get
(
getByte
());
case
ENUM:
case
ENUM:
...
@@ -680,7 +680,7 @@ public abstract class Value {
...
@@ -680,7 +680,7 @@ public abstract class Value {
case
INT:
{
case
INT:
{
switch
(
getType
())
{
switch
(
getType
())
{
case
BOOLEAN:
case
BOOLEAN:
return
ValueInt
.
get
(
getBoolean
()
.
booleanValue
()
?
1
:
0
);
return
ValueInt
.
get
(
getBoolean
()
?
1
:
0
);
case
BYTE:
case
BYTE:
return
ValueInt
.
get
(
getByte
());
return
ValueInt
.
get
(
getByte
());
case
ENUM:
case
ENUM:
...
@@ -706,7 +706,7 @@ public abstract class Value {
...
@@ -706,7 +706,7 @@ public abstract class Value {
case
LONG:
{
case
LONG:
{
switch
(
getType
())
{
switch
(
getType
())
{
case
BOOLEAN:
case
BOOLEAN:
return
ValueLong
.
get
(
getBoolean
()
.
booleanValue
()
?
1
:
0
);
return
ValueLong
.
get
(
getBoolean
()
?
1
:
0
);
case
BYTE:
case
BYTE:
return
ValueLong
.
get
(
getByte
());
return
ValueLong
.
get
(
getByte
());
case
SHORT:
case
SHORT:
...
@@ -737,8 +737,7 @@ public abstract class Value {
...
@@ -737,8 +737,7 @@ public abstract class Value {
case
DECIMAL:
{
case
DECIMAL:
{
switch
(
getType
())
{
switch
(
getType
())
{
case
BOOLEAN:
case
BOOLEAN:
return
ValueDecimal
.
get
(
BigDecimal
.
valueOf
(
return
ValueDecimal
.
get
(
BigDecimal
.
valueOf
(
getBoolean
()
?
1
:
0
));
getBoolean
().
booleanValue
()
?
1
:
0
));
case
BYTE:
case
BYTE:
return
ValueDecimal
.
get
(
BigDecimal
.
valueOf
(
getByte
()));
return
ValueDecimal
.
get
(
BigDecimal
.
valueOf
(
getByte
()));
case
SHORT:
case
SHORT:
...
@@ -774,7 +773,7 @@ public abstract class Value {
...
@@ -774,7 +773,7 @@ public abstract class Value {
case
DOUBLE:
{
case
DOUBLE:
{
switch
(
getType
())
{
switch
(
getType
())
{
case
BOOLEAN:
case
BOOLEAN:
return
ValueDouble
.
get
(
getBoolean
()
.
booleanValue
()
?
1
:
0
);
return
ValueDouble
.
get
(
getBoolean
()
?
1
:
0
);
case
BYTE:
case
BYTE:
return
ValueDouble
.
get
(
getByte
());
return
ValueDouble
.
get
(
getByte
());
case
SHORT:
case
SHORT:
...
@@ -797,7 +796,7 @@ public abstract class Value {
...
@@ -797,7 +796,7 @@ public abstract class Value {
case
FLOAT:
{
case
FLOAT:
{
switch
(
getType
())
{
switch
(
getType
())
{
case
BOOLEAN:
case
BOOLEAN:
return
ValueFloat
.
get
(
getBoolean
()
.
booleanValue
()
?
1
:
0
);
return
ValueFloat
.
get
(
getBoolean
()
?
1
:
0
);
case
BYTE:
case
BYTE:
return
ValueFloat
.
get
(
getByte
());
return
ValueFloat
.
get
(
getByte
());
case
SHORT:
case
SHORT:
...
...
h2/src/main/org/h2/value/ValueBoolean.java
浏览文件 @
6bb90ad6
...
@@ -30,10 +30,10 @@ public class ValueBoolean extends Value {
...
@@ -30,10 +30,10 @@ public class ValueBoolean extends Value {
private
static
final
Object
TRUE
=
new
ValueBoolean
(
true
);
private
static
final
Object
TRUE
=
new
ValueBoolean
(
true
);
private
static
final
Object
FALSE
=
new
ValueBoolean
(
false
);
private
static
final
Object
FALSE
=
new
ValueBoolean
(
false
);
private
final
B
oolean
value
;
private
final
b
oolean
value
;
private
ValueBoolean
(
boolean
value
)
{
private
ValueBoolean
(
boolean
value
)
{
this
.
value
=
Boolean
.
valueOf
(
value
)
;
this
.
value
=
value
;
}
}
@Override
@Override
...
@@ -48,24 +48,23 @@ public class ValueBoolean extends Value {
...
@@ -48,24 +48,23 @@ public class ValueBoolean extends Value {
@Override
@Override
public
String
getString
()
{
public
String
getString
()
{
return
value
.
booleanValue
()
?
"TRUE"
:
"FALSE"
;
return
value
?
"TRUE"
:
"FALSE"
;
}
}
@Override
@Override
public
Value
negate
()
{
public
Value
negate
()
{
return
(
ValueBoolean
)
(
value
.
booleanValue
()
?
FALSE
:
TRUE
);
return
(
ValueBoolean
)
(
value
?
FALSE
:
TRUE
);
}
}
@Override
@Override
public
B
oolean
getBoolean
()
{
public
b
oolean
getBoolean
()
{
return
value
;
return
value
;
}
}
@Override
@Override
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
boolean
v2
=
((
ValueBoolean
)
o
).
value
.
booleanValue
();
ValueBoolean
v
=
(
ValueBoolean
)
o
;
boolean
v
=
value
.
booleanValue
();
return
Boolean
.
compare
(
value
,
v
.
value
);
return
(
v
==
v2
)
?
0
:
(
v
?
1
:
-
1
);
}
}
@Override
@Override
...
@@ -75,7 +74,7 @@ public class ValueBoolean extends Value {
...
@@ -75,7 +74,7 @@ public class ValueBoolean extends Value {
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
value
.
booleanValue
()
?
1
:
0
;
return
value
?
1
:
0
;
}
}
@Override
@Override
...
@@ -86,7 +85,7 @@ public class ValueBoolean extends Value {
...
@@ -86,7 +85,7 @@ public class ValueBoolean extends Value {
@Override
@Override
public
void
set
(
PreparedStatement
prep
,
int
parameterIndex
)
public
void
set
(
PreparedStatement
prep
,
int
parameterIndex
)
throws
SQLException
{
throws
SQLException
{
prep
.
setBoolean
(
parameterIndex
,
value
.
booleanValue
()
);
prep
.
setBoolean
(
parameterIndex
,
value
);
}
}
/**
/**
...
...
h2/src/main/org/h2/value/ValueNull.java
浏览文件 @
6bb90ad6
...
@@ -63,8 +63,8 @@ public class ValueNull extends Value {
...
@@ -63,8 +63,8 @@ public class ValueNull extends Value {
}
}
@Override
@Override
public
B
oolean
getBoolean
()
{
public
b
oolean
getBoolean
()
{
return
null
;
return
false
;
}
}
@Override
@Override
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论