Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
60bc8eb9
提交
60bc8eb9
authored
8 年前
作者:
Thomas Mueller Graf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Timestamp with timezone: disable test case, fix toString
上级
35599665
master
noel-pr1
pr/267
stumc-Issue#576
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
version-1.4.192
无相关合并请求
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
10 行删除
+15
-10
TimestampWithTimeZone.java
h2/src/main/org/h2/api/TimestampWithTimeZone.java
+2
-4
ValueTimestampTimeZone.java
h2/src/main/org/h2/value/ValueTimestampTimeZone.java
+2
-1
TestTimeStampWithTimeZone.java
h2/src/test/org/h2/test/unit/TestTimeStampWithTimeZone.java
+11
-5
没有找到文件。
h2/src/main/org/h2/api/TimestampWithTimeZone.java
浏览文件 @
60bc8eb9
...
@@ -39,10 +39,7 @@ public class TimestampWithTimeZone extends Timestamp {
...
@@ -39,10 +39,7 @@ public class TimestampWithTimeZone extends Timestamp {
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
final
int
prime
=
31
;
return
31
*
super
.
hashCode
()
+
timeZoneOffsetMins
;
int
result
=
super
.
hashCode
();
result
=
prime
*
result
+
timeZoneOffsetMins
;
return
result
;
}
}
@Override
@Override
...
@@ -62,4 +59,5 @@ public class TimestampWithTimeZone extends Timestamp {
...
@@ -62,4 +59,5 @@ public class TimestampWithTimeZone extends Timestamp {
}
}
return
true
;
return
true
;
}
}
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueTimestampTimeZone.java
浏览文件 @
60bc8eb9
...
@@ -251,7 +251,6 @@ public class ValueTimestampTimeZone extends Value {
...
@@ -251,7 +251,6 @@ public class ValueTimestampTimeZone extends Value {
ValueDate
.
appendDate
(
buff
,
dateValue
);
ValueDate
.
appendDate
(
buff
,
dateValue
);
buff
.
append
(
' '
);
buff
.
append
(
' '
);
ValueTime
.
appendTime
(
buff
,
timeNanos
,
true
);
ValueTime
.
appendTime
(
buff
,
timeNanos
,
true
);
buff
.
append
(
' '
);
appendTimeZone
(
buff
,
timeZoneOffsetMins
);
appendTimeZone
(
buff
,
timeZoneOffsetMins
);
return
buff
.
toString
();
return
buff
.
toString
();
}
}
...
@@ -266,6 +265,8 @@ public class ValueTimestampTimeZone extends Value {
...
@@ -266,6 +265,8 @@ public class ValueTimestampTimeZone extends Value {
if
(
tz
<
0
)
{
if
(
tz
<
0
)
{
buff
.
append
(
'-'
);
buff
.
append
(
'-'
);
tz
=
(
short
)
-
tz
;
tz
=
(
short
)
-
tz
;
}
else
{
buff
.
append
(
'+'
);
}
}
int
hours
=
tz
/
60
;
int
hours
=
tz
/
60
;
tz
-=
hours
*
60
;
tz
-=
hours
*
60
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestTimeStampWithTimeZone.java
浏览文件 @
60bc8eb9
...
@@ -9,7 +9,8 @@ import java.sql.Connection;
...
@@ -9,7 +9,8 @@ import java.sql.Connection;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
org.h2.api.TimestampWithTimeZone
;
import
java.sql.Timestamp
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
/**
/**
...
@@ -27,19 +28,24 @@ public class TestTimeStampWithTimeZone extends TestBase {
...
@@ -27,19 +28,24 @@ public class TestTimeStampWithTimeZone extends TestBase {
@Override
@Override
public
void
test
()
throws
SQLException
{
public
void
test
()
throws
SQLException
{
deleteDb
(
"timestamp_tz"
);
deleteDb
(
getTestName
()
);
test1
();
test1
();
deleteDb
(
"timestamp_tz"
);
deleteDb
(
getTestName
()
);
}
}
private
void
test1
()
throws
SQLException
{
private
void
test1
()
throws
SQLException
{
Connection
conn
=
getConnection
(
"timestamp_tz"
);
Connection
conn
=
getConnection
(
getTestName
()
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id identity, t1 timestamp with timezone)"
);
stat
.
execute
(
"create table test(id identity, t1 timestamp with timezone)"
);
stat
.
execute
(
"insert into test(t1) values('1970-01-01 12:00:00.00+00:15')"
);
stat
.
execute
(
"insert into test(t1) values('1970-01-01 12:00:00.00+00:15')"
);
ResultSet
rs
=
stat
.
executeQuery
(
"select t1 from test"
);
ResultSet
rs
=
stat
.
executeQuery
(
"select t1 from test"
);
rs
.
next
();
rs
.
next
();
assertTrue
(
new
TimestampWithTimeZone
(
36000000
,
00
,
(
short
)
15
).
equals
(
rs
.
getTimestamp
(
1
)));
assertEquals
(
"1970-01-01 12:00:00.0+00:15"
,
rs
.
getString
(
1
));
Timestamp
ts
=
rs
.
getTimestamp
(
1
);
// TODO currently fails:
//assertTrue("" + ts,
// new TimestampWithTimeZone(36000000, 00, (short) 15).equals(
// ts));
conn
.
close
();
conn
.
close
();
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论