Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ca891f02
提交
ca891f02
authored
8月 14, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move sign into quotes
上级
8549969a
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
27 行增加
和
21 行删除
+27
-21
DateTimeUtils.java
h2/src/main/org/h2/util/DateTimeUtils.java
+3
-1
interval.sql
h2/src/test/org/h2/test/scripts/datatypes/interval.sql
+24
-20
没有找到文件。
h2/src/main/org/h2/util/DateTimeUtils.java
浏览文件 @
ca891f02
...
...
@@ -1654,9 +1654,11 @@ public class DateTimeUtils {
boolean
negative
=
leading
<
0
;
if
(
negative
)
{
leading
=
-
leading
;
buff
.
append
(
'-'
);
}
buff
.
append
(
'\''
);
if
(
negative
)
{
buff
.
append
(
'-'
);
}
switch
(
qualifier
)
{
case
YEAR:
case
MONTH:
...
...
h2/src/test/org/h2/test/scripts/datatypes/interval.sql
浏览文件 @
ca891f02
...
...
@@ -3,7 +3,8 @@
-- Initial Developer: H2 Group
--
CREATE
TABLE
TEST
(
I01
INTERVAL
YEAR
,
I02
INTERVAL
MONTH
,
I03
INTERVAL
DAY
,
I04
INTERVAL
HOUR
,
I05
INTERVAL
MINUTE
,
CREATE
TABLE
TEST
(
ID
INT
PRIMARY
KEY
,
I01
INTERVAL
YEAR
,
I02
INTERVAL
MONTH
,
I03
INTERVAL
DAY
,
I04
INTERVAL
HOUR
,
I05
INTERVAL
MINUTE
,
I06
INTERVAL
SECOND
,
I07
INTERVAL
YEAR
TO
MONTH
,
I08
INTERVAL
DAY
TO
HOUR
,
I09
INTERVAL
DAY
TO
MINUTE
,
I10
INTERVAL
DAY
TO
SECOND
,
I11
INTERVAL
HOUR
TO
MINUTE
,
I12
INTERVAL
HOUR
TO
SECOND
,
I13
INTERVAL
MINUTE
TO
SECOND
,
...
...
@@ -19,6 +20,7 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_PRECISION, NUMERI
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
>
COLUMN_NAME
DATA_TYPE
TYPE_NAME
COLUMN_TYPE
NUMERIC_PRECISION
NUMERIC_SCALE
DATETIME_PRECISION
INTERVAL_TYPE
INTERVAL_PRECISION
>
----------- --------- --------- ------------------------------- ----------------- ------------- ------------------ ---------------------- ------------------
>
ID
4
INTEGER
INT
NOT
NULL
10
0
null
null
null
>
I01
1111
INTERVAL
INTERVAL
YEAR
2
0
null
YEAR
2
>
I02
1111
INTERVAL
INTERVAL
MONTH
2
0
null
MONTH
2
>
I03
1111
INTERVAL
INTERVAL
DAY
2
0
null
DAY
2
...
...
@@ -45,9 +47,10 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_PRECISION, NUMERI
>
J11
1111
INTERVAL
INTERVAL
HOUR
(
5
)
TO
MINUTE
5
0
null
HOUR
(
5
)
TO
MINUTE
5
>
J12
1111
INTERVAL
INTERVAL
HOUR
(
5
)
TO
SECOND
(
9
)
5
9
9
HOUR
(
5
)
TO
SECOND
(
9
)
5
>
J13
1111
INTERVAL
INTERVAL
MINUTE
(
5
)
TO
SECOND
(
9
)
5
9
9
MINUTE
(
5
)
TO
SECOND
(
9
)
5
>
rows
(
ordered
):
2
6
>
rows
(
ordered
):
2
7
INSERT
INTO
TEST
VALUES
(
1
,
INTERVAL
'1'
YEAR
,
INTERVAL
'1'
MONTH
,
INTERVAL
'1'
DAY
,
INTERVAL
'1'
HOUR
,
INTERVAL
'1'
MINUTE
,
INTERVAL
'1.123456789'
SECOND
,
INTERVAL
'1-2'
YEAR
TO
MONTH
,
INTERVAL
'1 2'
DAY
TO
HOUR
,
INTERVAL
'1 2:3'
DAY
TO
MINUTE
,
INTERVAL
'1 2:3:4.123456789'
DAY
TO
SECOND
,
INTERVAL
'1:2'
HOUR
TO
MINUTE
,
...
...
@@ -57,6 +60,7 @@ INSERT INTO TEST VALUES (
INTERVAL
'1 2:3'
DAY
TO
MINUTE
,
INTERVAL
'1 2:3:4.123456789'
DAY
TO
SECOND
,
INTERVAL
'1:2'
HOUR
TO
MINUTE
,
INTERVAL
'1:2:3.123456789'
HOUR
TO
SECOND
,
INTERVAL
'1:2.123456789'
MINUTE
TO
SECOND
),
(
2
,
INTERVAL
'-1'
YEAR
,
INTERVAL
'-1'
MONTH
,
INTERVAL
'-1'
DAY
,
INTERVAL
'-1'
HOUR
,
INTERVAL
'-1'
MINUTE
,
INTERVAL
'-1.123456789'
SECOND
,
INTERVAL
'-1-2'
YEAR
TO
MONTH
,
INTERVAL
'-1 2'
DAY
TO
HOUR
,
INTERVAL
'-1 2:3'
DAY
TO
MINUTE
,
INTERVAL
'-1 2:3:4.123456789'
DAY
TO
SECOND
,
INTERVAL
'-1:2'
HOUR
TO
MINUTE
,
...
...
@@ -67,47 +71,47 @@ INSERT INTO TEST VALUES (
INTERVAL
-
'1:2:3.123456789'
HOUR
TO
SECOND
,
INTERVAL
-
'1:2.123456789'
MINUTE
TO
SECOND
);
>
update
count
:
2
SELECT
I01
,
I02
,
I03
,
I04
,
I05
,
I06
FROM
TEST
;
SELECT
I01
,
I02
,
I03
,
I04
,
I05
,
I06
FROM
TEST
ORDER
BY
ID
;
>
I01
I02
I03
I04
I05
I06
>
------------------ ------------------- ----------------- ------------------ -------------------- --------------------------
>
INTERVAL
'1'
YEAR
INTERVAL
'1'
MONTH
INTERVAL
'1'
DAY
INTERVAL
'1'
HOUR
INTERVAL
'1'
MINUTE
INTERVAL
'1.123457'
SECOND
>
INTERVAL
-
'1'
YEAR
INTERVAL
-
'1'
MONTH
INTERVAL
-
'1'
DAY
INTERVAL
-
'1'
HOUR
INTERVAL
-
'
1'
MINUTE
INTERVAL
'1.123457'
SECOND
>
rows
:
2
>
INTERVAL
'-1'
YEAR
INTERVAL
'-1'
MONTH
INTERVAL
'-1'
DAY
INTERVAL
'-1'
HOUR
INTERVAL
'-
1'
MINUTE
INTERVAL
'1.123457'
SECOND
>
rows
(
ordered
)
:
2
SELECT
I07
,
I08
,
I09
,
I10
FROM
TEST
;
SELECT
I07
,
I08
,
I09
,
I10
FROM
TEST
ORDER
BY
ID
;
>
I07
I08
I09
I10
>
----------------------------- ---------------------------- --------------------------------- ------------------------------------------
>
INTERVAL
'1-2'
YEAR
TO
MONTH
INTERVAL
'1 02'
DAY
TO
HOUR
INTERVAL
'1 02:03'
DAY
TO
MINUTE
INTERVAL
'1 02:03:04.123457'
DAY
TO
SECOND
>
INTERVAL
-
'1-2'
YEAR
TO
MONTH
INTERVAL
-
'1 02'
DAY
TO
HOUR
INTERVAL
-
'
1 02:03'
DAY
TO
MINUTE
INTERVAL
'1 02:03:04.123457'
DAY
TO
SECOND
>
rows
:
2
>
INTERVAL
'-1-2'
YEAR
TO
MONTH
INTERVAL
'-1 02'
DAY
TO
HOUR
INTERVAL
'-
1 02:03'
DAY
TO
MINUTE
INTERVAL
'1 02:03:04.123457'
DAY
TO
SECOND
>
rows
(
ordered
)
:
2
SELECT
I11
,
I12
,
I12
FROM
TEST
;
SELECT
I11
,
I12
,
I12
FROM
TEST
ORDER
BY
ID
;
>
I11
I12
I12
>
------------------------------- ---------------------------------------- ----------------------------------------
>
INTERVAL
'1:02'
HOUR
TO
MINUTE
INTERVAL
'1:02:03.123457'
HOUR
TO
SECOND
INTERVAL
'1:02:03.123457'
HOUR
TO
SECOND
>
INTERVAL
-
'
1:02'
HOUR
TO
MINUTE
INTERVAL
'1:02:03.123457'
HOUR
TO
SECOND
INTERVAL
'1:02:03.123457'
HOUR
TO
SECOND
>
rows
:
2
>
INTERVAL
'-
1:02'
HOUR
TO
MINUTE
INTERVAL
'1:02:03.123457'
HOUR
TO
SECOND
INTERVAL
'1:02:03.123457'
HOUR
TO
SECOND
>
rows
(
ordered
)
:
2
SELECT
J01
,
J02
,
J03
,
J04
,
J05
,
J06
FROM
TEST
;
SELECT
J01
,
J02
,
J03
,
J04
,
J05
,
J06
FROM
TEST
ORDER
BY
ID
;
>
J01
J02
J03
J04
J05
J06
>
------------------ ------------------- ----------------- ------------------ -------------------- ------------------------------
>
INTERVAL
'1'
YEAR
INTERVAL
'1'
MONTH
INTERVAL
'1'
DAY
INTERVAL
'1'
HOUR
INTERVAL
'1'
MINUTE
INTERVAL
'1.123456789'
SECOND
>
INTERVAL
-
'1'
YEAR
INTERVAL
-
'1'
MONTH
INTERVAL
-
'1'
DAY
INTERVAL
-
'1'
HOUR
INTERVAL
-
'1'
MINUTE
INTERVAL
-
'
1.123456789'
SECOND
>
rows
:
2
>
INTERVAL
'-1'
YEAR
INTERVAL
'-1'
MONTH
INTERVAL
'-1'
DAY
INTERVAL
'-1'
HOUR
INTERVAL
'-1'
MINUTE
INTERVAL
'-
1.123456789'
SECOND
>
rows
(
ordered
)
:
2
SELECT
J07
,
J08
,
J09
,
J10
FROM
TEST
;
SELECT
J07
,
J08
,
J09
,
J10
FROM
TEST
ORDER
BY
ID
;
>
J07
J08
J09
J10
>
----------------------------- ---------------------------- --------------------------------- ----------------------------------------------
>
INTERVAL
'1-2'
YEAR
TO
MONTH
INTERVAL
'1 02'
DAY
TO
HOUR
INTERVAL
'1 02:03'
DAY
TO
MINUTE
INTERVAL
'1 02:03:04.123456789'
DAY
TO
SECOND
>
INTERVAL
-
'1-2'
YEAR
TO
MONTH
INTERVAL
-
'1 02'
DAY
TO
HOUR
INTERVAL
-
'1 02:03'
DAY
TO
MINUTE
INTERVAL
-
'
1 02:03:04.123456789'
DAY
TO
SECOND
>
rows
:
2
>
INTERVAL
'-1-2'
YEAR
TO
MONTH
INTERVAL
'-1 02'
DAY
TO
HOUR
INTERVAL
'-1 02:03'
DAY
TO
MINUTE
INTERVAL
'-
1 02:03:04.123456789'
DAY
TO
SECOND
>
rows
(
ordered
)
:
2
SELECT
J11
,
J12
,
J12
FROM
TEST
;
SELECT
J11
,
J12
,
J12
FROM
TEST
ORDER
BY
ID
;
>
J11
J12
J12
>
------------------------------- -------------------------------------------- --------------------------------------------
>
INTERVAL
'1:02'
HOUR
TO
MINUTE
INTERVAL
'1:02:03.123456789'
HOUR
TO
SECOND
INTERVAL
'1:02:03.123456789'
HOUR
TO
SECOND
>
INTERVAL
-
'1:02'
HOUR
TO
MINUTE
INTERVAL
-
'1:02:03.123456789'
HOUR
TO
SECOND
INTERVAL
-
'
1:02:03.123456789'
HOUR
TO
SECOND
>
rows
:
2
>
INTERVAL
'-1:02'
HOUR
TO
MINUTE
INTERVAL
'-1:02:03.123456789'
HOUR
TO
SECOND
INTERVAL
'-
1:02:03.123456789'
HOUR
TO
SECOND
>
rows
(
ordered
)
:
2
DROP
TABLE
TEST
;
>
ok
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论