Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
954e57a3
提交
954e57a3
authored
2月 06, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Limit February 29 date conversion only to years before common transition to Gregorian
上级
883c4c4d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
19 行增加
和
1 行删除
+19
-1
LocalDateTimeUtils.java
h2/src/main/org/h2/util/LocalDateTimeUtils.java
+1
-1
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+18
-0
没有找到文件。
h2/src/main/org/h2/util/LocalDateTimeUtils.java
浏览文件 @
954e57a3
...
@@ -502,7 +502,7 @@ public class LocalDateTimeUtils {
...
@@ -502,7 +502,7 @@ public class LocalDateTimeUtils {
try
{
try
{
return
LOCAL_DATE_OF_YEAR_MONTH_DAY
.
invoke
(
null
,
year
,
month
,
day
);
return
LOCAL_DATE_OF_YEAR_MONTH_DAY
.
invoke
(
null
,
year
,
month
,
day
);
}
catch
(
InvocationTargetException
e
)
{
}
catch
(
InvocationTargetException
e
)
{
if
(
month
==
2
&&
day
==
29
)
{
if
(
year
<=
1500
&&
(
year
&
3
)
==
0
&&
month
==
2
&&
day
==
29
)
{
// If proleptic Gregorian doesn't have such date use the next day
// If proleptic Gregorian doesn't have such date use the next day
return
LOCAL_DATE_OF_YEAR_MONTH_DAY
.
invoke
(
null
,
year
,
3
,
1
);
return
LOCAL_DATE_OF_YEAR_MONTH_DAY
.
invoke
(
null
,
year
,
3
,
1
);
}
}
...
...
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
954e57a3
...
@@ -651,12 +651,30 @@ public class TestPreparedStatement extends TestBase {
...
@@ -651,12 +651,30 @@ public class TestPreparedStatement extends TestBase {
* Check that date that doesn't exist in proleptic Gregorian calendar can be
* Check that date that doesn't exist in proleptic Gregorian calendar can be
* read as a next date.
* read as a next date.
*/
*/
prep
.
setString
(
1
,
"1500-02-29"
);
rs
=
prep
.
executeQuery
();
rs
.
next
();
localDate2
=
rs
.
getObject
(
1
,
LocalDateTimeUtils
.
LOCAL_DATE
);
assertEquals
(
LocalDateTimeUtils
.
parseLocalDate
(
"1500-03-01"
),
localDate2
);
rs
.
close
();
prep
.
setString
(
1
,
"1400-02-29"
);
rs
=
prep
.
executeQuery
();
rs
.
next
();
localDate2
=
rs
.
getObject
(
1
,
LocalDateTimeUtils
.
LOCAL_DATE
);
assertEquals
(
LocalDateTimeUtils
.
parseLocalDate
(
"1400-03-01"
),
localDate2
);
rs
.
close
();
prep
.
setString
(
1
,
"1300-02-29"
);
prep
.
setString
(
1
,
"1300-02-29"
);
rs
=
prep
.
executeQuery
();
rs
=
prep
.
executeQuery
();
rs
.
next
();
rs
.
next
();
localDate2
=
rs
.
getObject
(
1
,
LocalDateTimeUtils
.
LOCAL_DATE
);
localDate2
=
rs
.
getObject
(
1
,
LocalDateTimeUtils
.
LOCAL_DATE
);
assertEquals
(
LocalDateTimeUtils
.
parseLocalDate
(
"1300-03-01"
),
localDate2
);
assertEquals
(
LocalDateTimeUtils
.
parseLocalDate
(
"1300-03-01"
),
localDate2
);
rs
.
close
();
rs
.
close
();
prep
.
setString
(
1
,
"-0100-02-29"
);
rs
=
prep
.
executeQuery
();
rs
.
next
();
localDate2
=
rs
.
getObject
(
1
,
LocalDateTimeUtils
.
LOCAL_DATE
);
assertEquals
(
LocalDateTimeUtils
.
parseLocalDate
(
"-0100-03-01"
),
localDate2
);
rs
.
close
();
/*
/*
* Check that date that doesn't exist in traditional calendar can be set and
* Check that date that doesn't exist in traditional calendar can be set and
* read with LocalDate and can be read with getDate() as a next date.
* read with LocalDate and can be read with getDate() as a next date.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论