Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
18602ef4
提交
18602ef4
authored
6 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove STORE_LOCAL_TIME code
this has been hardcoded to false for quite some time now
上级
d4ed1a5d
master
version-1.4.198
无相关合并请求
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
65 行删除
+9
-65
Data.java
h2/src/main/org/h2/store/Data.java
+9
-65
没有找到文件。
h2/src/main/org/h2/store/Data.java
浏览文件 @
18602ef4
...
...
@@ -93,15 +93,6 @@ public class Data {
private
static
final
long
MILLIS_PER_MINUTE
=
1000
*
60
;
/**
* Can not store the local time, because doing so with old database files
* that didn't do it could result in an ArrayIndexOutOfBoundsException. The
* reason is that adding a row to a page only allocated space for the new
* row, but didn't take into account that existing rows now can use more
* space, due to the changed format.
*/
private
static
final
boolean
STORE_LOCAL_TIME
=
false
;
/**
* The data itself.
*/
...
...
@@ -487,48 +478,20 @@ public class Data {
break
;
}
case
Value
.
TIME
:
if
(
STORE_LOCAL_TIME
)
{
writeByte
((
byte
)
LOCAL_TIME
);
ValueTime
t
=
(
ValueTime
)
v
;
long
nanos
=
t
.
getNanos
();
long
millis
=
nanos
/
1_000_000
;
nanos
-=
millis
*
1_000_000
;
writeVarLong
(
millis
);
writeVarLong
(
nanos
);
}
else
{
writeByte
((
byte
)
type
);
writeVarLong
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
v
.
getTime
()));
}
break
;
case
Value
.
DATE
:
{
if
(
STORE_LOCAL_TIME
)
{
writeByte
((
byte
)
LOCAL_DATE
);
long
x
=
((
ValueDate
)
v
).
getDateValue
();
writeVarLong
(
x
);
}
else
{
writeByte
((
byte
)
type
);
long
x
=
DateTimeUtils
.
getTimeLocalWithoutDst
(
v
.
getDate
());
writeVarLong
(
x
/
MILLIS_PER_MINUTE
);
}
break
;
}
case
Value
.
TIMESTAMP
:
{
if
(
STORE_LOCAL_TIME
)
{
writeByte
((
byte
)
LOCAL_TIMESTAMP
);
ValueTimestamp
ts
=
(
ValueTimestamp
)
v
;
long
dateValue
=
ts
.
getDateValue
();
writeVarLong
(
dateValue
);
long
nanos
=
ts
.
getTimeNanos
();
long
millis
=
nanos
/
1_000_000
;
nanos
-=
millis
*
1_000_000
;
writeVarLong
(
millis
);
writeVarLong
(
nanos
);
}
else
{
Timestamp
ts
=
v
.
getTimestamp
();
writeByte
((
byte
)
type
);
writeVarLong
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
));
writeVarInt
(
ts
.
getNanos
()
%
1_000_000
);
}
break
;
}
case
Value
.
TIMESTAMP_TZ
:
{
...
...
@@ -1012,31 +975,12 @@ public class Data {
return
1
+
getVarIntLen
(
scale
)
+
getVarIntLen
(
bytes
.
length
)
+
bytes
.
length
;
}
case
Value
.
TIME
:
if
(
STORE_LOCAL_TIME
)
{
long
nanos
=
((
ValueTime
)
v
).
getNanos
();
long
millis
=
nanos
/
1_000_000
;
nanos
-=
millis
*
1_000_000
;
return
1
+
getVarLongLen
(
millis
)
+
getVarLongLen
(
nanos
);
}
return
1
+
getVarLongLen
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
v
.
getTime
()));
case
Value
.
DATE
:
{
if
(
STORE_LOCAL_TIME
)
{
long
dateValue
=
((
ValueDate
)
v
).
getDateValue
();
return
1
+
getVarLongLen
(
dateValue
);
}
long
x
=
DateTimeUtils
.
getTimeLocalWithoutDst
(
v
.
getDate
());
return
1
+
getVarLongLen
(
x
/
MILLIS_PER_MINUTE
);
}
case
Value
.
TIMESTAMP
:
{
if
(
STORE_LOCAL_TIME
)
{
ValueTimestamp
ts
=
(
ValueTimestamp
)
v
;
long
dateValue
=
ts
.
getDateValue
();
long
nanos
=
ts
.
getTimeNanos
();
long
millis
=
nanos
/
1_000_000
;
nanos
-=
millis
*
1_000_000
;
return
1
+
getVarLongLen
(
dateValue
)
+
getVarLongLen
(
millis
)
+
getVarLongLen
(
nanos
);
}
Timestamp
ts
=
v
.
getTimestamp
();
return
1
+
getVarLongLen
(
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
))
+
getVarIntLen
(
ts
.
getNanos
()
%
1_000_000
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论