Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6d54fb23
Unverified
提交
6d54fb23
authored
4月 17, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
4月 17, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1070 from katzyn/datetime
Restore support of DATETIME(precision)
上级
0b9b6cf0
42a00817
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
34 行增加
和
4 行删除
+34
-4
help.csv
h2/src/docsrc/help/help.csv
+2
-1
changelog.html
h2/src/docsrc/html/changelog.html
+4
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+14
-1
timestamp.sql
h2/src/test/org/h2/test/scripts/datatypes/timestamp.sql
+14
-2
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
6d54fb23
...
@@ -2671,11 +2671,12 @@ DATE
...
@@ -2671,11 +2671,12 @@ DATE
"Data Types","TIMESTAMP Type","
"Data Types","TIMESTAMP Type","
{ TIMESTAMP [ ( precisionInt ) ] [ WITHOUT TIME ZONE ]
{ TIMESTAMP [ ( precisionInt ) ] [ WITHOUT TIME ZONE ]
| DATETIME | SMALLDATETIME }
| DATETIME
[ ( precisionInt ) ]
| SMALLDATETIME }
","
","
The timestamp data type. The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn].
The timestamp data type. The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn].
Stored internally as a BCD-encoded date, and nanoseconds since midnight.
Stored internally as a BCD-encoded date, and nanoseconds since midnight.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.
If fractional seconds precision is specified it should be from 0 to 9, 6 is default.
Fractional seconds precision of SMALLDATETIME is always 0 and cannot be specified.
Mapped to ""java.sql.Timestamp"" (""java.util.Date"" may be used too).
Mapped to ""java.sql.Timestamp"" (""java.util.Date"" may be used too).
""java.time.LocalDateTime"" is also supported on Java 8 and later versions.
""java.time.LocalDateTime"" is also supported on Java 8 and later versions.
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
6d54fb23
...
@@ -21,8 +21,12 @@ Change Log
...
@@ -21,8 +21,12 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul>
<ul>
<li>
Issue #1069: Failed to add DATETIME(3) column since 1.4.197
</li>
<li>
Issue #456: H2 table privileges referring to old schema after schema rename
<li>
Issue #456: H2 table privileges referring to old schema after schema rename
</li>
</li>
<li>
Issue #1062: Concurrent update in table "SYS" caused by Analyze.analyzeTable()
</li>
<li>
Yet another fix to Page memory accounting
<li>
Yet another fix to Page memory accounting
</li>
</li>
<li>
Replace MVStore.ASSERT variable with assertions
<li>
Replace MVStore.ASSERT variable with assertions
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
6d54fb23
...
@@ -4475,6 +4475,20 @@ public class Parser {
...
@@ -4475,6 +4475,20 @@ public class Parser {
precision
=
displaySize
=
ValueTimestampTimeZone
.
getDisplaySize
(
originalScale
);
precision
=
displaySize
=
ValueTimestampTimeZone
.
getDisplaySize
(
originalScale
);
break
;
break
;
}
}
}
else
if
(
original
.
equals
(
"DATETIME"
))
{
if
(
readIf
(
"("
))
{
originalScale
=
readPositiveInt
();
if
(
originalScale
>
ValueTime
.
MAXIMUM_SCALE
)
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
Integer
.
toString
(
originalScale
));
}
read
(
")"
);
scale
=
originalScale
;
original
=
original
+
'('
+
originalScale
+
')'
;
precision
=
displaySize
=
ValueTimestamp
.
getDisplaySize
(
originalScale
);
}
}
else
if
(
original
.
equals
(
"SMALLDATETIME"
))
{
scale
=
0
;
precision
=
displaySize
=
ValueTimestamp
.
getDisplaySize
(
0
);
}
}
}
else
if
(
readIf
(
"("
))
{
}
else
if
(
readIf
(
"("
))
{
if
(!
readIf
(
"MAX"
))
{
if
(!
readIf
(
"MAX"
))
{
...
@@ -4562,7 +4576,6 @@ public class Parser {
...
@@ -4562,7 +4576,6 @@ public class Parser {
Integer
.
toString
(
scale
),
Long
.
toString
(
precision
));
Integer
.
toString
(
scale
),
Long
.
toString
(
precision
));
}
}
Column
column
=
new
Column
(
columnName
,
type
,
precision
,
scale
,
Column
column
=
new
Column
(
columnName
,
type
,
precision
,
scale
,
displaySize
,
enumerators
);
displaySize
,
enumerators
);
if
(
templateColumn
!=
null
)
{
if
(
templateColumn
!=
null
)
{
...
...
h2/src/test/org/h2/test/scripts/datatypes/timestamp.sql
浏览文件 @
6d54fb23
...
@@ -15,7 +15,9 @@ SELECT T1, T2, T1 = T2 FROM TEST;
...
@@ -15,7 +15,9 @@ SELECT T1, T2, T1 = T2 FROM TEST;
>
2010
-
01
-
01
10
:
00
:
00
2010
-
01
-
01
10
:
00
:
00
TRUE
>
2010
-
01
-
01
10
:
00
:
00
2010
-
01
-
01
10
:
00
:
00
TRUE
>
rows
:
1
>
rows
:
1
ALTER
TABLE
TEST
ADD
(
T3
TIMESTAMP
(
0
),
T4
TIMESTAMP
(
9
)
WITHOUT
TIME
ZONE
);
ALTER
TABLE
TEST
ADD
(
T3
TIMESTAMP
(
0
),
T4
TIMESTAMP
(
9
)
WITHOUT
TIME
ZONE
,
DT1
DATETIME
,
DT2
DATETIME
(
0
),
DT3
DATETIME
(
9
),
SDT1
SMALLDATETIME
);
>
ok
SELECT
COLUMN_NAME
,
DATA_TYPE
,
TYPE_NAME
,
COLUMN_TYPE
,
NUMERIC_SCALE
FROM
INFORMATION_SCHEMA
.
COLUMNS
SELECT
COLUMN_NAME
,
DATA_TYPE
,
TYPE_NAME
,
COLUMN_TYPE
,
NUMERIC_SCALE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
...
@@ -25,11 +27,21 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
...
@@ -25,11 +27,21 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
>
T2
93
TIMESTAMP
TIMESTAMP
WITHOUT
TIME
ZONE
6
>
T2
93
TIMESTAMP
TIMESTAMP
WITHOUT
TIME
ZONE
6
>
T3
93
TIMESTAMP
TIMESTAMP
(
0
)
0
>
T3
93
TIMESTAMP
TIMESTAMP
(
0
)
0
>
T4
93
TIMESTAMP
TIMESTAMP
(
9
)
WITHOUT
TIME
ZONE
9
>
T4
93
TIMESTAMP
TIMESTAMP
(
9
)
WITHOUT
TIME
ZONE
9
>
rows
(
ordered
):
4
>
DT1
93
TIMESTAMP
DATETIME
6
>
DT2
93
TIMESTAMP
DATETIME
(
0
)
0
>
DT3
93
TIMESTAMP
DATETIME
(
9
)
9
>
SDT1
93
TIMESTAMP
SMALLDATETIME
0
>
rows
(
ordered
):
8
ALTER
TABLE
TEST
ADD
T5
TIMESTAMP
(
10
);
ALTER
TABLE
TEST
ADD
T5
TIMESTAMP
(
10
);
>
exception
>
exception
ALTER
TABLE
TEST
ADD
DT4
DATETIME
(
10
);
>
exception
ALTER
TABLE
TEST
ADD
STD2
SMALLDATETIME
(
1
);
>
exception
DROP
TABLE
TEST
;
DROP
TABLE
TEST
;
>
ok
>
ok
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论