Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a906ce7f
提交
a906ce7f
authored
11月 15, 2017
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue #654: List ENUM type values in INFORMATION_SCHEMA.COLUMNS
上级
ac33aa6d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
29 行增加
和
10 行删除
+29
-10
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
Column.java
h2/src/main/org/h2/table/Column.java
+9
-1
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+5
-2
enum.sql
h2/src/test/org/h2/test/scripts/datatypes/enum.sql
+6
-0
testScript.sql
h2/src/test/org/h2/test/scripts/testScript.sql
+7
-7
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
a906ce7f
...
@@ -21,6 +21,8 @@ Change Log
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul>
<ul>
<li>
Issue #654: List ENUM type values in INFORMATION_SCHEMA.COLUMNS
</li>
<li>
Issue #668: Fail of an update command on large table with ENUM column
<li>
Issue #668: Fail of an update command on large table with ENUM column
</li>
</li>
<li>
Issue #662: column called CONSTRAINT is not properly escaped when storing to metadata
<li>
Issue #662: column called CONSTRAINT is not properly escaped when storing to metadata
...
...
h2/src/main/org/h2/table/Column.java
浏览文件 @
a906ce7f
...
@@ -471,9 +471,17 @@ public class Column {
...
@@ -471,9 +471,17 @@ public class Column {
}
}
}
}
public
String
getCreateSQLWithoutName
()
{
return
getCreateSQL
(
false
);
}
public
String
getCreateSQL
()
{
public
String
getCreateSQL
()
{
return
getCreateSQL
(
true
);
}
private
String
getCreateSQL
(
boolean
includeName
)
{
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buff
=
new
StringBuilder
();
if
(
name
!=
null
)
{
if
(
includeName
&&
name
!=
null
)
{
buff
.
append
(
Parser
.
quoteIdentifier
(
name
)).
append
(
' '
);
buff
.
append
(
Parser
.
quoteIdentifier
(
name
)).
append
(
' '
);
}
}
if
(
originalSQL
!=
null
)
{
if
(
originalSQL
!=
null
)
{
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
a906ce7f
...
@@ -174,7 +174,8 @@ public class MetaTable extends Table {
...
@@ -174,7 +174,8 @@ public class MetaTable extends Table {
"CHECK_CONSTRAINT"
,
"CHECK_CONSTRAINT"
,
"SEQUENCE_NAME"
,
"SEQUENCE_NAME"
,
"REMARKS"
,
"REMARKS"
,
"SOURCE_DATA_TYPE SMALLINT"
"SOURCE_DATA_TYPE SMALLINT"
,
"COLUMN_TYPE"
);
);
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
...
@@ -828,7 +829,9 @@ public class MetaTable extends Table {
...
@@ -828,7 +829,9 @@ public class MetaTable extends Table {
// REMARKS
// REMARKS
replaceNullWithEmpty
(
c
.
getComment
()),
replaceNullWithEmpty
(
c
.
getComment
()),
// SOURCE_DATA_TYPE
// SOURCE_DATA_TYPE
null
null
,
// COLUMN_TYPE
c
.
getCreateSQLWithoutName
()
);
);
}
}
}
}
...
...
h2/src/test/org/h2/test/scripts/datatypes/enum.sql
浏览文件 @
a906ce7f
...
@@ -48,6 +48,12 @@ select rank from card where suit = 'diamonds';
...
@@ -48,6 +48,12 @@ select rank from card where suit = 'diamonds';
>
----
>
----
>
8
>
8
select
column_type
from
information_schema
.
columns
where
COLUMN_NAME
=
'SUIT'
;
>
COLUMN_TYPE
>
------------------------------------------
>
ENUM
(
'hearts'
,
'clubs'
,
'spades'
,
'diamonds'
)
>
rows
:
1
--- ENUM integer-based operations
--- ENUM integer-based operations
select
rank
from
card
where
suit
=
1
;
select
rank
from
card
where
suit
=
1
;
...
...
h2/src/test/org/h2/test/scripts/testScript.sql
浏览文件 @
a906ce7f
...
@@ -2705,13 +2705,13 @@ create memory table orders ( orderid varchar(10), name varchar(20), customer_id
...
@@ -2705,13 +2705,13 @@ create memory table orders ( orderid varchar(10), name varchar(20), customer_id
> ok
> ok
select * from information_schema.columns where table_name = '
ORDERS
';
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 CHARACTER_SET_NAME COLLATION_NAME TYPE_NAME NULLABLE IS_COMPUTED SELECTIVITY CHECK_CONSTRAINT SEQUENCE_NAME REMARKS SOURCE_DATA_TYPE
> 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 CHARACTER_SET_NAME COLLATION_NAME TYPE_NAME NULLABLE IS_COMPUTED SELECTIVITY CHECK_CONSTRAINT SEQUENCE_NAME REMARKS SOURCE_DATA_TYPE
COLUMN_TYPE
> ------------- ------------ ---------- ----------- ---------------- -------------- ----------- --------- ------------------------ ---------------------- ----------------- ----------------------- ------------- ------------------ -------------- --------- -------- ----------- ----------- ---------------- ------------- ------- ----------------
> ------------- ------------ ---------- ----------- ---------------- -------------- ----------- --------- ------------------------ ---------------------- ----------------- ----------------------- ------------- ------------------ -------------- --------- -------- ----------- ----------- ---------------- ------------- ------- ----------------
-------------------
> SCRIPT PUBLIC ORDERS COMPLETED 4 null NO 3 1 1 1 10 0 Unicode OFF DECIMAL 0 FALSE 50 null null
> SCRIPT PUBLIC ORDERS COMPLETED 4 null NO 3 1 1 1 10 0 Unicode OFF DECIMAL 0 FALSE 50 null null
NUMERIC(1) NOT NULL
> SCRIPT PUBLIC ORDERS CUSTOMER_ID 3 null YES 12 10 10 10 10 0 Unicode OFF VARCHAR 1 FALSE 50 null null
> SCRIPT PUBLIC ORDERS CUSTOMER_ID 3 null YES 12 10 10 10 10 0 Unicode OFF VARCHAR 1 FALSE 50 null null
VARCHAR(10)
> SCRIPT PUBLIC ORDERS NAME 2 null YES 12 20 20 20 10 0 Unicode OFF VARCHAR 1 FALSE 50 null null
> SCRIPT PUBLIC ORDERS NAME 2 null YES 12 20 20 20 10 0 Unicode OFF VARCHAR 1 FALSE 50 null null
VARCHAR(20)
> SCRIPT PUBLIC ORDERS ORDERID 1 null YES 12 10 10 10 10 0 Unicode OFF VARCHAR 1 FALSE 50 null null
> SCRIPT PUBLIC ORDERS ORDERID 1 null YES 12 10 10 10 10 0 Unicode OFF VARCHAR 1 FALSE 50 null null
VARCHAR(10)
> SCRIPT PUBLIC ORDERS VERIFIED 5 null YES 3 1 1 1 10 0 Unicode OFF DECIMAL 1 FALSE 50 null null
> SCRIPT PUBLIC ORDERS VERIFIED 5 null YES 3 1 1 1 10 0 Unicode OFF DECIMAL 1 FALSE 50 null null
NUMERIC(1)
> rows: 5
> rows: 5
drop table orders;
drop table orders;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论