Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4dd2d02c
提交
4dd2d02c
authored
7 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add Constraint.Type.getSqlName()
上级
0ea0365c
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
18 行删除
+19
-18
Constraint.java
h2/src/main/org/h2/constraint/Constraint.java
+17
-1
ConstraintUnique.java
h2/src/main/org/h2/constraint/ConstraintUnique.java
+1
-8
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+1
-9
没有找到文件。
h2/src/main/org/h2/constraint/Constraint.java
浏览文件 @
4dd2d02c
...
...
@@ -39,7 +39,23 @@ public abstract class Constraint extends SchemaObjectBase implements
/**
* The constraint type for referential constraints.
*/
REFERENTIAL
REFERENTIAL
;
/**
* Get standard SQL type name.
*
* @return standard SQL type name
*/
public
String
getSqlName
()
{
if
(
this
==
Constraint
.
Type
.
PRIMARY_KEY
)
{
return
"PRIMARY KEY"
;
}
if
(
this
==
Constraint
.
Type
.
REFERENTIAL
)
{
return
"FOREIGN KEY"
;
}
return
name
();
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constraint/ConstraintUnique.java
浏览文件 @
4dd2d02c
...
...
@@ -54,7 +54,7 @@ public class ConstraintUnique extends Constraint {
if
(
comment
!=
null
)
{
buff
.
append
(
" COMMENT "
).
append
(
StringUtils
.
quoteStringSQL
(
comment
));
}
buff
.
append
(
' '
).
append
(
get
Type
Name
()).
append
(
'('
);
buff
.
append
(
' '
).
append
(
get
ConstraintType
().
getSql
Name
()).
append
(
'('
);
for
(
IndexColumn
c
:
columns
)
{
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
Parser
.
quoteIdentifier
(
c
.
column
.
getName
()));
...
...
@@ -66,13 +66,6 @@ public class ConstraintUnique extends Constraint {
return
buff
.
toString
();
}
private
String
getTypeName
()
{
if
(
primaryKey
)
{
return
"PRIMARY KEY"
;
}
return
"UNIQUE"
;
}
@Override
public
String
getCreateSQLWithoutIndexes
()
{
return
getCreateSQLForCopy
(
table
,
getSQL
(),
false
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
4dd2d02c
...
...
@@ -1953,14 +1953,6 @@ public class MetaTable extends Table {
if
(!
checkIndex
(
session
,
tableName
,
indexFrom
,
indexTo
))
{
continue
;
}
String
constraintTypeAsString
;
if
(
constraintType
==
Constraint
.
Type
.
PRIMARY_KEY
)
{
constraintTypeAsString
=
"PRIMARY KEY"
;
}
else
if
(
constraintType
==
Constraint
.
Type
.
REFERENTIAL
)
{
constraintTypeAsString
=
"FOREIGN KEY"
;
}
else
{
constraintTypeAsString
=
constraintType
.
name
();
}
add
(
rows
,
// CONSTRAINT_CATALOG
catalog
,
...
...
@@ -1969,7 +1961,7 @@ public class MetaTable extends Table {
// CONSTRAINT_NAME
identifier
(
constraint
.
getName
()),
// CONSTRAINT_TYPE
constraintType
AsString
,
constraintType
.
getSqlName
()
,
// TABLE_CATALOG
catalog
,
// TABLE_SCHEMA
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论