Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0a7566c2
提交
0a7566c2
authored
9月 15, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Store local date/time when using the MVStoreTableEngine
上级
fb83e7dc
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
24 行增加
和
62 行删除
+24
-62
ValueDataType.java
h2/src/main/org/h2/mvstore/db/ValueDataType.java
+24
-62
没有找到文件。
h2/src/main/org/h2/mvstore/db/ValueDataType.java
浏览文件 @
0a7566c2
...
@@ -9,12 +9,9 @@ package org.h2.mvstore.db;
...
@@ -9,12 +9,9 @@ package org.h2.mvstore.db;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.sql.Date
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Time
;
import
java.sql.Timestamp
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.constant.SysProperties
;
...
@@ -26,7 +23,6 @@ import org.h2.store.Data;
...
@@ -26,7 +23,6 @@ import org.h2.store.Data;
import
org.h2.store.DataHandler
;
import
org.h2.store.DataHandler
;
import
org.h2.store.LobStorageFrontend
;
import
org.h2.store.LobStorageFrontend
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.value.CompareMode
;
import
org.h2.value.CompareMode
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueArray
;
...
@@ -73,11 +69,6 @@ public class ValueDataType implements DataType {
...
@@ -73,11 +69,6 @@ public class ValueDataType implements DataType {
private
static
final
int
LONG_NEG
=
67
;
private
static
final
int
LONG_NEG
=
67
;
private
static
final
int
STRING_0_31
=
68
;
private
static
final
int
STRING_0_31
=
68
;
private
static
final
int
BYTES_0_31
=
100
;
private
static
final
int
BYTES_0_31
=
100
;
private
static
final
int
LOCAL_TIME
=
132
;
private
static
final
int
LOCAL_DATE
=
133
;
private
static
final
int
LOCAL_TIMESTAMP
=
134
;
private
static
final
long
MILLIS_PER_MINUTE
=
1000
*
60
;
final
DataHandler
handler
;
final
DataHandler
handler
;
final
CompareMode
compareMode
;
final
CompareMode
compareMode
;
...
@@ -238,49 +229,32 @@ public class ValueDataType implements DataType {
...
@@ -238,49 +229,32 @@ public class ValueDataType implements DataType {
}
}
break
;
break
;
}
}
case
Value
.
TIME
:
case
Value
.
TIME
:
{
if
(
SysProperties
.
STORE_LOCAL_TIME
)
{
buff
.
put
((
byte
)
type
);
buff
.
put
((
byte
)
LOCAL_TIME
);
ValueTime
t
=
(
ValueTime
)
v
;
ValueTime
t
=
(
ValueTime
)
v
;
long
nanos
=
t
.
getNanos
();
long
nanos
=
t
.
getNanos
();
long
millis
=
nanos
/
1000000
;
long
millis
=
nanos
/
1000000
;
nanos
-=
millis
*
1000000
;
nanos
-=
millis
*
1000000
;
writeVarLong
(
buff
,
millis
);
writeVarLong
(
buff
,
millis
);
writeVarLong
(
buff
,
nanos
);
writeVarLong
(
buff
,
nanos
);
}
else
{
buff
.
put
((
byte
)
type
);
writeVarLong
(
buff
,
DateTimeUtils
.
getTimeLocalWithoutDst
(
v
.
getTime
()));
}
break
;
break
;
}
case
Value
.
DATE
:
{
case
Value
.
DATE
:
{
if
(
SysProperties
.
STORE_LOCAL_TIME
)
{
buff
.
put
((
byte
)
type
);
buff
.
put
((
byte
)
LOCAL_DATE
);
long
x
=
((
ValueDate
)
v
).
getDateValue
();
long
x
=
((
ValueDate
)
v
).
getDateValue
();
writeVarLong
(
buff
,
x
);
writeVarLong
(
buff
,
x
);
}
else
{
buff
.
put
((
byte
)
type
);
long
x
=
DateTimeUtils
.
getTimeLocalWithoutDst
(
v
.
getDate
());
writeVarLong
(
buff
,
x
/
MILLIS_PER_MINUTE
);
}
break
;
break
;
}
}
case
Value
.
TIMESTAMP
:
{
case
Value
.
TIMESTAMP
:
{
if
(
SysProperties
.
STORE_LOCAL_TIME
)
{
buff
.
put
((
byte
)
type
);
buff
.
put
((
byte
)
LOCAL_TIMESTAMP
);
ValueTimestamp
ts
=
(
ValueTimestamp
)
v
;
ValueTimestamp
ts
=
(
ValueTimestamp
)
v
;
long
dateValue
=
ts
.
getDateValue
();
long
dateValue
=
ts
.
getDateValue
();
writeVarLong
(
buff
,
dateValue
);
writeVarLong
(
buff
,
dateValue
);
long
nanos
=
ts
.
getNanos
();
long
nanos
=
ts
.
getNanos
();
long
millis
=
nanos
/
1000000
;
long
millis
=
nanos
/
1000000
;
nanos
-=
millis
*
1000000
;
nanos
-=
millis
*
1000000
;
writeVarLong
(
buff
,
millis
);
writeVarLong
(
buff
,
millis
);
writeVarLong
(
buff
,
nanos
);
writeVarLong
(
buff
,
nanos
);
}
else
{
Timestamp
ts
=
v
.
getTimestamp
();
buff
.
put
((
byte
)
type
);
writeVarLong
(
buff
,
DateTimeUtils
.
getTimeLocalWithoutDst
(
ts
));
writeVarInt
(
buff
,
ts
.
getNanos
());
}
break
;
break
;
}
}
case
Value
.
JAVA_OBJECT
:
{
case
Value
.
JAVA_OBJECT
:
{
...
@@ -545,30 +519,18 @@ public class ValueDataType implements DataType {
...
@@ -545,30 +519,18 @@ public class ValueDataType implements DataType {
BigInteger
b
=
new
BigInteger
(
buff2
);
BigInteger
b
=
new
BigInteger
(
buff2
);
return
ValueDecimal
.
get
(
new
BigDecimal
(
b
,
scale
));
return
ValueDecimal
.
get
(
new
BigDecimal
(
b
,
scale
));
}
}
case
LOCAL_DATE:
{
return
ValueDate
.
fromDateValue
(
readVarLong
(
buff
));
}
case
Value
.
DATE
:
{
case
Value
.
DATE
:
{
long
x
=
readVarLong
(
buff
)
*
MILLIS_PER_MINUTE
;
return
ValueDate
.
fromDateValue
(
readVarLong
(
buff
));
return
ValueDate
.
get
(
new
Date
(
DateTimeUtils
.
getTimeUTCWithoutDst
(
x
)));
}
}
case
LOCAL_
TIME:
{
case
Value
.
TIME
:
{
long
nanos
=
readVarLong
(
buff
)
*
1000000
+
readVarLong
(
buff
);
long
nanos
=
readVarLong
(
buff
)
*
1000000
+
readVarLong
(
buff
);
return
ValueTime
.
fromNanos
(
nanos
);
return
ValueTime
.
fromNanos
(
nanos
);
}
}
case
Value
.
TIME
:
case
Value
.
TIMESTAMP
:
{
// need to normalize the year, month and day
return
ValueTime
.
get
(
new
Time
(
DateTimeUtils
.
getTimeUTCWithoutDst
(
readVarLong
(
buff
))));
case
LOCAL_TIMESTAMP:
{
long
dateValue
=
readVarLong
(
buff
);
long
dateValue
=
readVarLong
(
buff
);
long
nanos
=
readVarLong
(
buff
)
*
1000000
+
readVarLong
(
buff
);
long
nanos
=
readVarLong
(
buff
)
*
1000000
+
readVarLong
(
buff
);
return
ValueTimestamp
.
fromDateValueAndNanos
(
dateValue
,
nanos
);
return
ValueTimestamp
.
fromDateValueAndNanos
(
dateValue
,
nanos
);
}
}
case
Value
.
TIMESTAMP
:
{
Timestamp
ts
=
new
Timestamp
(
DateTimeUtils
.
getTimeUTCWithoutDst
(
readVarLong
(
buff
)));
ts
.
setNanos
(
readVarInt
(
buff
));
return
ValueTimestamp
.
get
(
ts
);
}
case
Value
.
BYTES
:
{
case
Value
.
BYTES
:
{
int
len
=
readVarInt
(
buff
);
int
len
=
readVarInt
(
buff
);
byte
[]
b
=
DataUtils
.
newBytes
(
len
);
byte
[]
b
=
DataUtils
.
newBytes
(
len
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论