Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
af63ced3
Unverified
提交
af63ced3
authored
10月 08, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
10月 08, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1508 from katzyn/meta
Add INFORMATION_SCHEMA.COLUMNS.DOMAIN_*
上级
68f46168
617df841
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
47 行增加
和
37 行删除
+47
-37
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+10
-0
decimal_decimal.sql
...rc/test/org/h2/test/scripts/datatypes/decimal_decimal.sql
+7
-7
decimal_numeric.sql
...rc/test/org/h2/test/scripts/datatypes/decimal_numeric.sql
+7
-7
enum.sql
h2/src/test/org/h2/test/scripts/datatypes/enum.sql
+7
-7
dropDomain.sql
h2/src/test/org/h2/test/scripts/ddl/dropDomain.sql
+16
-16
没有找到文件。
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
af63ced3
...
...
@@ -165,6 +165,9 @@ public class MetaTable extends Table {
"TABLE_NAME"
,
"COLUMN_NAME"
,
"ORDINAL_POSITION INT"
,
"DOMAIN_CATALOG"
,
"DOMAIN_SCHEMA"
,
"DOMAIN_NAME"
,
"COLUMN_DEFAULT"
,
"IS_NULLABLE"
,
"DATA_TYPE INT"
,
...
...
@@ -843,6 +846,7 @@ public class MetaTable extends Table {
String
collation
=
database
.
getCompareMode
().
getName
();
for
(
int
j
=
0
;
j
<
cols
.
length
;
j
++)
{
Column
c
=
cols
[
j
];
UserDataType
domain
=
c
.
getUserDataType
();
DataType
dataType
=
c
.
getDataType
();
ValueInt
precision
=
ValueInt
.
get
(
c
.
getPrecisionAsInt
());
ValueInt
scale
=
ValueInt
.
get
(
c
.
getScale
());
...
...
@@ -876,6 +880,12 @@ public class MetaTable extends Table {
identifier
(
c
.
getName
()),
// ORDINAL_POSITION
ValueInt
.
get
(
j
+
1
),
// DOMAIN_CATALOG
domain
!=
null
?
catalog
:
null
,
// DOMAIN_SCHEMA
domain
!=
null
?
Constants
.
SCHEMA_MAIN
:
null
,
// DOMAIN_NAME
domain
!=
null
?
domain
.
getName
()
:
null
,
// COLUMN_DEFAULT
c
.
getDefaultSQL
(),
// IS_NULLABLE
...
...
h2/src/test/org/h2/test/scripts/datatypes/decimal_decimal.sql
浏览文件 @
af63ced3
...
...
@@ -9,13 +9,13 @@ create memory table orders ( orderid varchar(10), name varchar(20), customer_id
>
ok
select
*
from
information_schema
.
columns
where
table_name
=
'ORDERS'
;
>
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
COLUMN_DEFAULT
IS_NULLABLE
DATA_TYPE
CHARACTER_MAXIMUM_LENGTH
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION
NUMERIC_PRECISION_RADIX
NUMERIC_SCALE
DATETIME_PRECISION
INTERVAL_TYPE
INTERVAL_PRECISION
CHARACTER_SET_NAME
COLLATION_NAME
TYPE_NAME
NULLABLE
IS_COMPUTED
SELECTIVITY
CHECK_CONSTRAINT
SEQUENCE_NAME
REMARKS
SOURCE_DATA_TYPE
COLUMN_TYPE
COLUMN_ON_UPDATE
IS_VISIBLE
>
------------- ------------ ---------- ----------- ---------------- -------------- ----------- --------- ------------------------ ---------------------- ----------------- ----------------------- ------------- ------------------ ------------- ------------------ ------------------ -------------- --------- -------- ----------- ----------- ---------------- ------------- ------- ---------------- ------------------- ---------------- ----------
>
SCRIPT
PUBLIC
ORDERS
COMPLETED
4
null
NO
3
1
1
1
10
0
null
null
null
Unicode
OFF
DECIMAL
0
FALSE
50
null
null
NUMERIC
(
1
)
NOT
NULL
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
CUSTOMER_ID
3
null
YES
12
10
10
10
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
10
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
NAME
2
null
YES
12
20
20
20
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
20
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
ORDERID
1
null
YES
12
10
10
10
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
10
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
VERIFIED
5
null
YES
3
1
1
1
10
0
null
null
null
Unicode
OFF
DECIMAL
1
FALSE
50
null
null
NUMERIC
(
1
)
null
TRUE
>
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
DOMAIN_CATALOG
DOMAIN_SCHEMA
DOMAIN_NAME
COLUMN_DEFAULT
IS_NULLABLE
DATA_TYPE
CHARACTER_MAXIMUM_LENGTH
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION
NUMERIC_PRECISION_RADIX
NUMERIC_SCALE
DATETIME_PRECISION
INTERVAL_TYPE
INTERVAL_PRECISION
CHARACTER_SET_NAME
COLLATION_NAME
TYPE_NAME
NULLABLE
IS_COMPUTED
SELECTIVITY
CHECK_CONSTRAINT
SEQUENCE_NAME
REMARKS
SOURCE_DATA_TYPE
COLUMN_TYPE
COLUMN_ON_UPDATE
IS_VISIBLE
>
------------- ------------ ---------- ----------- ---------------- -------------- -----------
-- ----------- -------------- -----------
--------- ------------------------ ---------------------- ----------------- ----------------------- ------------- ------------------ ------------- ------------------ ------------------ -------------- --------- -------- ----------- ----------- ---------------- ------------- ------- ---------------- ------------------- ---------------- ----------
>
SCRIPT
PUBLIC
ORDERS
COMPLETED
4
null
null
null
null
NO
3
1
1
1
10
0
null
null
null
Unicode
OFF
DECIMAL
0
FALSE
50
null
null
NUMERIC
(
1
)
NOT
NULL
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
CUSTOMER_ID
3
null
null
null
null
YES
12
10
10
10
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
10
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
NAME
2
null
null
null
null
YES
12
20
20
20
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
20
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
ORDERID
1
null
null
null
null
YES
12
10
10
10
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
10
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
VERIFIED
5
null
null
null
null
YES
3
1
1
1
10
0
null
null
null
Unicode
OFF
DECIMAL
1
FALSE
50
null
null
NUMERIC
(
1
)
null
TRUE
>
rows
:
5
drop
table
orders
;
...
...
h2/src/test/org/h2/test/scripts/datatypes/decimal_numeric.sql
浏览文件 @
af63ced3
...
...
@@ -9,13 +9,13 @@ create memory table orders ( orderid varchar(10), name varchar(20), customer_id
>
ok
select
*
from
information_schema
.
columns
where
table_name
=
'ORDERS'
;
>
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
COLUMN_DEFAULT
IS_NULLABLE
DATA_TYPE
CHARACTER_MAXIMUM_LENGTH
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION
NUMERIC_PRECISION_RADIX
NUMERIC_SCALE
DATETIME_PRECISION
INTERVAL_TYPE
INTERVAL_PRECISION
CHARACTER_SET_NAME
COLLATION_NAME
TYPE_NAME
NULLABLE
IS_COMPUTED
SELECTIVITY
CHECK_CONSTRAINT
SEQUENCE_NAME
REMARKS
SOURCE_DATA_TYPE
COLUMN_TYPE
COLUMN_ON_UPDATE
IS_VISIBLE
>
------------- ------------ ---------- ----------- ---------------- -------------- ----------- --------- ------------------------ ---------------------- ----------------- ----------------------- ------------- ------------------ ------------- ------------------ ------------------ -------------- --------- -------- ----------- ----------- ---------------- ------------- ------- ---------------- ------------------- ---------------- ----------
>
SCRIPT
PUBLIC
ORDERS
COMPLETED
4
null
NO
2
1
1
1
10
0
null
null
null
Unicode
OFF
NUMERIC
0
FALSE
50
null
null
NUMERIC
(
1
)
NOT
NULL
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
CUSTOMER_ID
3
null
YES
12
10
10
10
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
10
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
NAME
2
null
YES
12
20
20
20
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
20
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
ORDERID
1
null
YES
12
10
10
10
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
10
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
VERIFIED
5
null
YES
2
1
1
1
10
0
null
null
null
Unicode
OFF
NUMERIC
1
FALSE
50
null
null
NUMERIC
(
1
)
null
TRUE
>
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
DOMAIN_CATALOG
DOMAIN_SCHEMA
DOMAIN_NAME
COLUMN_DEFAULT
IS_NULLABLE
DATA_TYPE
CHARACTER_MAXIMUM_LENGTH
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION
NUMERIC_PRECISION_RADIX
NUMERIC_SCALE
DATETIME_PRECISION
INTERVAL_TYPE
INTERVAL_PRECISION
CHARACTER_SET_NAME
COLLATION_NAME
TYPE_NAME
NULLABLE
IS_COMPUTED
SELECTIVITY
CHECK_CONSTRAINT
SEQUENCE_NAME
REMARKS
SOURCE_DATA_TYPE
COLUMN_TYPE
COLUMN_ON_UPDATE
IS_VISIBLE
>
------------- ------------ ---------- ----------- ---------------- -------------- -----------
-- ----------- -------------- -----------
--------- ------------------------ ---------------------- ----------------- ----------------------- ------------- ------------------ ------------- ------------------ ------------------ -------------- --------- -------- ----------- ----------- ---------------- ------------- ------- ---------------- ------------------- ---------------- ----------
>
SCRIPT
PUBLIC
ORDERS
COMPLETED
4
null
null
null
null
NO
2
1
1
1
10
0
null
null
null
Unicode
OFF
NUMERIC
0
FALSE
50
null
null
NUMERIC
(
1
)
NOT
NULL
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
CUSTOMER_ID
3
null
null
null
null
YES
12
10
10
10
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
10
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
NAME
2
null
null
null
null
YES
12
20
20
20
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
20
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
ORDERID
1
null
null
null
null
YES
12
10
10
10
10
0
null
null
null
Unicode
OFF
VARCHAR
1
FALSE
50
null
null
VARCHAR
(
10
)
null
TRUE
>
SCRIPT
PUBLIC
ORDERS
VERIFIED
5
null
null
null
null
YES
2
1
1
1
10
0
null
null
null
Unicode
OFF
NUMERIC
1
FALSE
50
null
null
NUMERIC
(
1
)
null
TRUE
>
rows
:
5
drop
table
orders
;
...
...
h2/src/test/org/h2/test/scripts/datatypes/enum.sql
浏览文件 @
af63ced3
...
...
@@ -251,13 +251,13 @@ SELECT * FROM V3;
>>
-
1
SELECT
*
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
COLUMN_NAME
=
'E'
ORDER
BY
TABLE_NAME
;
>
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
COLUMN_DEFAULT
IS_NULLABLE
DATA_TYPE
CHARACTER_MAXIMUM_LENGTH
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION
NUMERIC_PRECISION_RADIX
NUMERIC_SCALE
DATETIME_PRECISION
INTERVAL_TYPE
INTERVAL_PRECISION
CHARACTER_SET_NAME
COLLATION_NAME
TYPE_NAME
NULLABLE
IS_COMPUTED
SELECTIVITY
CHECK_CONSTRAINT
SEQUENCE_NAME
REMARKS
SOURCE_DATA_TYPE
COLUMN_TYPE
COLUMN_ON_UPDATE
IS_VISIBLE
>
------------- ------------ ---------- ----------- ---------------- -------------- ----------- --------- ------------------------ ---------------------- ----------------- ----------------------- ------------- ------------------ ------------- ------------------ ------------------ -------------- --------- -------- ----------- ----------- ---------------- ------------- ------- ---------------- -------------- ---------------- ----------
>
SCRIPT
PUBLIC
TEST
E
1
null
YES
1111
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
ENUM
1
FALSE
50
null
null
ENUM
(
'A'
,
'B'
)
null
TRUE
>
SCRIPT
PUBLIC
V
E
1
null
YES
1111
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
ENUM
1
FALSE
50
null
null
ENUM
(
'A'
,
'B'
)
null
TRUE
>
SCRIPT
PUBLIC
V1
E
1
null
YES
4
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
INTEGER
1
FALSE
50
null
null
INTEGER
null
TRUE
>
SCRIPT
PUBLIC
V2
E
1
null
YES
4
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
INTEGER
1
FALSE
50
null
null
INTEGER
null
TRUE
>
SCRIPT
PUBLIC
V3
E
1
null
YES
4
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
INTEGER
1
FALSE
50
null
null
INTEGER
null
TRUE
>
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
ORDINAL_POSITION
DOMAIN_CATALOG
DOMAIN_SCHEMA
DOMAIN_NAME
COLUMN_DEFAULT
IS_NULLABLE
DATA_TYPE
CHARACTER_MAXIMUM_LENGTH
CHARACTER_OCTET_LENGTH
NUMERIC_PRECISION
NUMERIC_PRECISION_RADIX
NUMERIC_SCALE
DATETIME_PRECISION
INTERVAL_TYPE
INTERVAL_PRECISION
CHARACTER_SET_NAME
COLLATION_NAME
TYPE_NAME
NULLABLE
IS_COMPUTED
SELECTIVITY
CHECK_CONSTRAINT
SEQUENCE_NAME
REMARKS
SOURCE_DATA_TYPE
COLUMN_TYPE
COLUMN_ON_UPDATE
IS_VISIBLE
>
------------- ------------ ---------- ----------- ---------------- -------------- -----------
-- ----------- -------------- -----------
--------- ------------------------ ---------------------- ----------------- ----------------------- ------------- ------------------ ------------- ------------------ ------------------ -------------- --------- -------- ----------- ----------- ---------------- ------------- ------- ---------------- -------------- ---------------- ----------
>
SCRIPT
PUBLIC
TEST
E
1
null
null
null
null
YES
1111
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
ENUM
1
FALSE
50
null
null
ENUM
(
'A'
,
'B'
)
null
TRUE
>
SCRIPT
PUBLIC
V
E
1
null
null
null
null
YES
1111
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
ENUM
1
FALSE
50
null
null
ENUM
(
'A'
,
'B'
)
null
TRUE
>
SCRIPT
PUBLIC
V1
E
1
null
null
null
null
YES
4
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
INTEGER
1
FALSE
50
null
null
INTEGER
null
TRUE
>
SCRIPT
PUBLIC
V2
E
1
null
null
null
null
YES
4
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
INTEGER
1
FALSE
50
null
null
INTEGER
null
TRUE
>
SCRIPT
PUBLIC
V3
E
1
null
null
null
null
YES
4
2147483647
2147483647
2147483647
10
0
null
null
null
Unicode
OFF
INTEGER
1
FALSE
50
null
null
INTEGER
null
TRUE
>
rows
(
ordered
):
5
DROP
VIEW
V
;
...
...
h2/src/test/org/h2/test/scripts/ddl/dropDomain.sql
浏览文件 @
af63ced3
...
...
@@ -15,14 +15,14 @@ CREATE TABLE TEST(I INT PRIMARY KEY, E1 E, E2 E NOT NULL, E3 E_NN, E4 E_NN NULL)
INSERT
INTO
TEST
VALUES
(
1
,
'A'
,
'B'
,
'A'
,
'B'
);
>
update
count
:
1
SELECT
COLUMN_NAME
,
NULLABLE
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
>
COLUMN_NAME
NULLABLE
COLUMN_TYPE
>
----------- -------- -------------
>
I
0
INT
NOT
NULL
>
E1
1
E
>
E2
0
E
NOT
NULL
>
E3
0
E_NN
NOT
NULL
>
E4
1
E_NN
NULL
SELECT
COLUMN_NAME
,
DOMAIN_CATALOG
,
DOMAIN_SCHEMA
,
DOMAIN_NAME
,
NULLABLE
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
>
COLUMN_NAME
DOMAIN_CATALOG
DOMAIN_SCHEMA
DOMAIN_NAME
NULLABLE
COLUMN_TYPE
>
----------- --------
------ ------------- ----------- --------
-------------
>
I
null
null
null
0
INT
NOT
NULL
>
E1
SCRIPT
PUBLIC
E
1
E
>
E2
SCRIPT
PUBLIC
E
0
E
NOT
NULL
>
E3
SCRIPT
PUBLIC
E_NN
0
E_NN
NOT
NULL
>
E4
SCRIPT
PUBLIC
E_NN
1
E_NN
NULL
>
rows
(
ordered
):
5
DROP
DOMAIN
E
RESTRICT
;
...
...
@@ -34,14 +34,14 @@ DROP DOMAIN E CASCADE;
DROP
DOMAIN
E_NN
CASCADE
;
>
ok
SELECT
COLUMN_NAME
,
NULLABLE
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
>
COLUMN_NAME
NULLABLE
COLUMN_TYPE
>
----------- -------- -----------------------
>
I
0
INT
NOT
NULL
>
E1
1
ENUM
(
'A'
,
'B'
)
>
E2
0
ENUM
(
'A'
,
'B'
)
NOT
NULL
>
E3
0
ENUM
(
'A'
,
'B'
)
NOT
NULL
>
E4
1
ENUM
(
'A'
,
'B'
)
SELECT
COLUMN_NAME
,
DOMAIN_CATALOG
,
DOMAIN_SCHEMA
,
DOMAIN_NAME
,
NULLABLE
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
>
COLUMN_NAME
DOMAIN_CATALOG
DOMAIN_SCHEMA
DOMAIN_NAME
NULLABLE
COLUMN_TYPE
>
----------- --------
------ ------------- ----------- --------
-----------------------
>
I
null
null
null
0
INT
NOT
NULL
>
E1
null
null
null
1
ENUM
(
'A'
,
'B'
)
>
E2
null
null
null
0
ENUM
(
'A'
,
'B'
)
NOT
NULL
>
E3
null
null
null
0
ENUM
(
'A'
,
'B'
)
NOT
NULL
>
E4
null
null
null
1
ENUM
(
'A'
,
'B'
)
>
rows
(
ordered
):
5
DROP
TABLE
TEST
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论