Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
16b47879
提交
16b47879
authored
1月 19, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move MIN and MAX constants to ValueLong
上级
ec489730
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
23 行增加
和
25 行删除
+23
-25
Parser.java
h2/src/main/org/h2/command/Parser.java
+2
-2
MVDelegateIndex.java
h2/src/main/org/h2/mvstore/db/MVDelegateIndex.java
+3
-5
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+2
-12
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+3
-3
ValueLong.java
h2/src/main/org/h2/value/ValueLong.java
+13
-3
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
16b47879
...
...
@@ -3186,7 +3186,7 @@ public class Parser {
.
compareTo
(
ValueLong
.
MIN_BD
)
==
0
)
{
// convert Long.MIN_VALUE to type 'long'
// (Long.MAX_VALUE+1 is of type 'decimal')
r
=
ValueExpression
.
get
(
ValueLong
.
get
(
Long
.
MIN_VALUE
)
);
r
=
ValueExpression
.
get
(
ValueLong
.
MIN
);
}
read
();
}
else
{
...
...
@@ -3813,7 +3813,7 @@ public class Parser {
checkLiterals
(
false
);
if
(!
containsE
&&
sub
.
indexOf
(
'.'
)
<
0
)
{
BigInteger
bi
=
new
BigInteger
(
sub
);
if
(
bi
.
compareTo
(
ValueLong
.
MAX
)
<=
0
)
{
if
(
bi
.
compareTo
(
ValueLong
.
MAX
_BI
)
<=
0
)
{
// parse constants like "10000000L"
if
(
chars
[
i
]
==
'L'
)
{
parseIndex
++;
...
...
h2/src/main/org/h2/mvstore/db/MVDelegateIndex.java
浏览文件 @
16b47879
...
...
@@ -66,12 +66,10 @@ public class MVDelegateIndex extends BaseIndex implements MVIndex {
@Override
public
Cursor
find
(
Session
session
,
SearchRow
first
,
SearchRow
last
)
{
ValueLong
min
=
mainIndex
.
getKey
(
first
,
MVPrimaryIndex
.
MIN
,
MVPrimaryIndex
.
MIN
);
// ifNull is MIN_VALUE as well, because the column is never NULL
ValueLong
min
=
mainIndex
.
getKey
(
first
,
ValueLong
.
MIN
,
ValueLong
.
MIN
);
// ifNull is MIN as well, because the column is never NULL
// so avoid returning all rows (returning one row is OK)
ValueLong
max
=
mainIndex
.
getKey
(
last
,
MVPrimaryIndex
.
MAX
,
MVPrimaryIndex
.
MIN
);
ValueLong
max
=
mainIndex
.
getKey
(
last
,
ValueLong
.
MAX
,
ValueLong
.
MIN
);
return
mainIndex
.
find
(
session
,
min
,
max
);
}
...
...
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
16b47879
...
...
@@ -37,16 +37,6 @@ import org.h2.value.ValueNull;
*/
public
class
MVPrimaryIndex
extends
BaseIndex
{
/**
* The minimum long value.
*/
static
final
ValueLong
MIN
=
ValueLong
.
get
(
Long
.
MIN_VALUE
);
/**
* The maximum long value.
*/
static
final
ValueLong
MAX
=
ValueLong
.
get
(
Long
.
MAX_VALUE
);
private
final
MVTable
mvTable
;
private
final
String
mapName
;
private
final
TransactionMap
<
Value
,
Value
>
dataMap
;
...
...
@@ -172,7 +162,7 @@ public class MVPrimaryIndex extends BaseIndex {
public
Cursor
find
(
Session
session
,
SearchRow
first
,
SearchRow
last
)
{
ValueLong
min
,
max
;
if
(
first
==
null
)
{
min
=
MIN
;
min
=
ValueLong
.
MIN
;
}
else
if
(
mainIndexColumn
<
0
)
{
min
=
ValueLong
.
get
(
first
.
getKey
());
}
else
{
...
...
@@ -184,7 +174,7 @@ public class MVPrimaryIndex extends BaseIndex {
}
}
if
(
last
==
null
)
{
max
=
MAX
;
max
=
ValueLong
.
MAX
;
}
else
if
(
mainIndexColumn
<
0
)
{
max
=
ValueLong
.
get
(
last
.
getKey
());
}
else
{
...
...
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
16b47879
...
...
@@ -140,7 +140,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
Value
[]
array
=
rowData
.
getList
();
// don't change the original value
array
=
array
.
clone
();
array
[
keyColumns
-
1
]
=
ValueLong
.
get
(
Long
.
MIN_VALUE
)
;
array
[
keyColumns
-
1
]
=
ValueLong
.
MIN
;
ValueArray
unique
=
ValueArray
.
get
(
array
);
SearchRow
row
=
convertToSearchRow
(
rowData
);
if
(!
mayHaveNullDuplicates
(
row
))
{
...
...
@@ -194,7 +194,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
if
(
indexType
.
isUnique
())
{
// this will detect committed entries only
unique
=
convertToKey
(
row
);
unique
.
getList
()[
keyColumns
-
1
]
=
ValueLong
.
get
(
Long
.
MIN_VALUE
)
;
unique
.
getList
()[
keyColumns
-
1
]
=
ValueLong
.
MIN
;
if
(
mayHaveNullDuplicates
(
row
))
{
// No further unique checks required
unique
=
null
;
...
...
@@ -261,7 +261,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
private
Cursor
find
(
Session
session
,
SearchRow
first
,
boolean
bigger
,
SearchRow
last
)
{
ValueArray
min
=
convertToKey
(
first
);
if
(
min
!=
null
)
{
min
.
getList
()[
keyColumns
-
1
]
=
ValueLong
.
get
(
Long
.
MIN_VALUE
)
;
min
.
getList
()[
keyColumns
-
1
]
=
ValueLong
.
MIN
;
}
TransactionMap
<
Value
,
Value
>
map
=
getMap
(
session
);
if
(
bigger
&&
min
!=
null
)
{
...
...
h2/src/main/org/h2/value/ValueLong.java
浏览文件 @
16b47879
...
...
@@ -18,10 +18,20 @@ import org.h2.message.DbException;
*/
public
class
ValueLong
extends
Value
{
/**
* The smallest {@code ValueLong} value.
*/
public
static
final
ValueLong
MIN
=
get
(
Long
.
MIN_VALUE
);
/**
* The largest {@code ValueLong} value.
*/
public
static
final
ValueLong
MAX
=
get
(
Long
.
MAX_VALUE
);
/**
* The largest Long value, as a BigInteger.
*/
public
static
final
BigInteger
MAX
=
BigInteger
.
valueOf
(
Long
.
MAX_VALUE
);
public
static
final
BigInteger
MAX
_BI
=
BigInteger
.
valueOf
(
Long
.
MAX_VALUE
);
/**
* The smallest Long value, as a BigDecimal.
...
...
@@ -39,7 +49,7 @@ public class ValueLong extends Value {
*/
public
static
final
int
DISPLAY_SIZE
=
20
;
private
static
final
BigInteger
MIN
=
BigInteger
.
valueOf
(
Long
.
MIN_VALUE
);
private
static
final
BigInteger
MIN
_BI
=
BigInteger
.
valueOf
(
Long
.
MIN_VALUE
);
private
static
final
int
STATIC_SIZE
=
100
;
private
static
final
ValueLong
[]
STATIC_CACHE
;
...
...
@@ -128,7 +138,7 @@ public class ValueLong extends Value {
BigInteger
bv
=
BigInteger
.
valueOf
(
value
);
BigInteger
bo
=
BigInteger
.
valueOf
(
other
.
value
);
BigInteger
br
=
bv
.
multiply
(
bo
);
if
(
br
.
compareTo
(
MIN
)
<
0
||
br
.
compareTo
(
MAX
)
>
0
)
{
if
(
br
.
compareTo
(
MIN
_BI
)
<
0
||
br
.
compareTo
(
MAX_BI
)
>
0
)
{
throw
getOverflow
();
}
return
ValueLong
.
get
(
br
.
longValue
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论