Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
3e5d6415
提交
3e5d6415
authored
7 年前
作者:
Noel Grandin
提交者:
GitHub
7 年前
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #496 from marschall/bind-timestamp-with-time-zone
TimestampWithTimeZone can not be bound
上级
b1c09339
04673de8
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
0 行删除
+31
-0
DataType.java
h2/src/main/org/h2/value/DataType.java
+2
-0
TestTimeStampWithTimeZone.java
h2/src/test/org/h2/test/unit/TestTimeStampWithTimeZone.java
+29
-0
没有找到文件。
h2/src/main/org/h2/value/DataType.java
浏览文件 @
3e5d6415
...
...
@@ -1121,6 +1121,8 @@ public class DataType {
return
LocalDateTimeUtils
.
localDateTimeToValue
(
x
);
}
else
if
(
LocalDateTimeUtils
.
isOffsetDateTime
(
x
.
getClass
()))
{
return
LocalDateTimeUtils
.
offsetDateTimeToValue
(
x
);
}
else
if
(
x
instanceof
TimestampWithTimeZone
)
{
return
ValueTimestampTimeZone
.
get
((
TimestampWithTimeZone
)
x
);
}
else
{
if
(
JdbcUtils
.
customDataTypesHandler
!=
null
)
{
return
JdbcUtils
.
customDataTypesHandler
.
getValue
(
type
,
x
,
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestTimeStampWithTimeZone.java
浏览文件 @
3e5d6415
...
...
@@ -6,13 +6,16 @@
package
org
.
h2
.
test
.
unit
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.api.TimestampWithTimeZone
;
import
org.h2.test.TestBase
;
import
org.h2.util.LocalDateTimeUtils
;
import
org.h2.value.Value
;
import
org.h2.value.ValueTimestampTimeZone
;
/**
...
...
@@ -35,6 +38,7 @@ public class TestTimeStampWithTimeZone extends TestBase {
test2
();
test3
();
test4
();
test5
();
testOrder
();
deleteDb
(
getTestName
());
}
...
...
@@ -139,6 +143,31 @@ public class TestTimeStampWithTimeZone extends TestBase {
assertEquals
(
c
,
0
);
}
private
void
test5
()
throws
SQLException
{
Connection
conn
=
getConnection
(
getTestName
());
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test5(id identity, t1 timestamp with time zone)"
);
stat
.
execute
(
"insert into test5(t1) values('2016-09-24 00:00:00.000000001+00:01')"
);
stat
.
execute
(
"insert into test5(t1) values('2017-04-20 00:00:00.000000001+00:01')"
);
PreparedStatement
preparedStatement
=
conn
.
prepareStatement
(
"select id"
+
" from test5"
+
" where (t1 < ?)"
);
Value
value
=
ValueTimestampTimeZone
.
parse
(
"2016-12-24 00:00:00.000000001+00:01"
);
preparedStatement
.
setObject
(
1
,
value
.
getObject
());
ResultSet
rs
=
preparedStatement
.
executeQuery
();
assertTrue
(
rs
.
next
());
assertEquals
(
1
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
rs
.
close
();
preparedStatement
.
close
();
stat
.
close
();
conn
.
close
();
}
private
void
testOrder
()
throws
SQLException
{
Connection
conn
=
getConnection
(
getTestName
());
Statement
stat
=
conn
.
createStatement
();
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论