Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
fa65d743
提交
fa65d743
authored
16 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Timestamp columns such as TIMESTAMP(6) were not compatible to other database.
上级
854bdc17
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
35 行增加
和
14 行删除
+35
-14
Parser.java
h2/src/main/org/h2/command/Parser.java
+21
-14
test.in.txt
h2/src/test/org/h2/test/test.in.txt
+14
-0
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
fa65d743
...
@@ -3244,8 +3244,8 @@ public class Parser {
...
@@ -3244,8 +3244,8 @@ public class Parser {
dataType
=
DataType
.
getTypeByName
(
original
);
dataType
=
DataType
.
getTypeByName
(
original
);
}
}
if
(
dataType
.
type
==
Value
.
NULL
)
{
if
(
dataType
.
type
==
Value
.
NULL
)
{
//
w
e do support NULL in the database meta data,
//
W
e do support NULL in the database meta data,
// but not actually when creating tables
// but not actually when creating tables
.
throw
Message
.
getSQLException
(
ErrorCode
.
UNKNOWN_DATA_TYPE_1
,
original
);
throw
Message
.
getSQLException
(
ErrorCode
.
UNKNOWN_DATA_TYPE_1
,
original
);
}
}
if
(
regular
)
{
if
(
regular
)
{
...
@@ -3256,35 +3256,42 @@ public class Parser {
...
@@ -3256,35 +3256,42 @@ public class Parser {
scale
=
scale
==
-
1
?
dataType
.
defaultScale
:
scale
;
scale
=
scale
==
-
1
?
dataType
.
defaultScale
:
scale
;
if
(
dataType
.
supportsPrecision
||
dataType
.
supportsScale
)
{
if
(
dataType
.
supportsPrecision
||
dataType
.
supportsScale
)
{
if
(
readIf
(
"("
))
{
if
(
readIf
(
"("
))
{
precision
=
readLong
();
long
p
=
readLong
();
if
(
readIf
(
"K"
))
{
if
(
readIf
(
"K"
))
{
p
recision
*=
1024
;
p
*=
1024
;
}
else
if
(
readIf
(
"M"
))
{
}
else
if
(
readIf
(
"M"
))
{
p
recision
*=
1024
*
1024
;
p
*=
1024
*
1024
;
}
else
if
(
readIf
(
"G"
))
{
}
else
if
(
readIf
(
"G"
))
{
p
recision
*=
1024
*
1024
*
1024
;
p
*=
1024
*
1024
*
1024
;
}
}
if
(
p
recision
>
Long
.
MAX_VALUE
)
{
if
(
p
>
Long
.
MAX_VALUE
)
{
p
recision
=
Long
.
MAX_VALUE
;
p
=
Long
.
MAX_VALUE
;
}
}
displaySize
=
MathUtils
.
convertLongToInt
(
precision
);
original
+=
"("
+
p
;
original
+=
"("
+
precision
;
// Oracle syntax
// oracle syntax
readIf
(
"CHAR"
);
readIf
(
"CHAR"
);
if
(
dataType
.
supportsScale
)
{
if
(
dataType
.
supportsScale
)
{
if
(
readIf
(
","
))
{
if
(
readIf
(
","
))
{
scale
=
getInt
();
scale
=
getInt
();
original
+=
", "
+
scale
;
original
+=
", "
+
scale
;
}
else
{
}
else
{
scale
=
0
;
// special case: TIMESTAMP(5) actually means TIMESTAMP(23, 5)
if
(
dataType
.
type
==
Value
.
TIMESTAMP
)
{
scale
=
MathUtils
.
convertLongToInt
(
p
);
p
=
precision
;
}
else
{
scale
=
0
;
}
}
}
}
}
precision
=
p
;
displaySize
=
MathUtils
.
convertLongToInt
(
precision
);
original
+=
")"
;
original
+=
")"
;
read
(
")"
);
read
(
")"
);
}
}
}
else
if
(
readIf
(
"("
))
{
}
else
if
(
readIf
(
"("
))
{
//
support for MySQL: INT(11), MEDIUMINT(8) and so on. Just ignore
//
Support for MySQL: INT(11), MEDIUMINT(8) and so on.
// the precision.
//
Just ignore
the precision.
getPositiveInt
();
getPositiveInt
();
read
(
")"
);
read
(
")"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/test.in.txt
浏览文件 @
fa65d743
--- special grammar and test cases ---------------------------------------------------------------------------------------------
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(t0 timestamp(0), t1 timestamp(1), t4 timestamp(4));
> ok
select column_name, numeric_scale from information_schema.columns c where c.table_name = 'TEST' order by column_name;
> COLUMN_NAME NUMERIC_SCALE
> ----------- -------------
> T0 0
> T1 1
> T4 4
> rows (ordered): 3
drop table test;
> ok
create table test(id int);
create table test(id int);
> ok
> ok
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论