Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
3510a7f9
提交
3510a7f9
authored
12 年前
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add some comments to this large method
上级
13f10ade
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
7 行删除
+18
-7
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+18
-7
没有找到文件。
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
3510a7f9
...
...
@@ -70,8 +70,10 @@ public class ScriptCommand extends ScriptBase {
private
Set
<
String
>
schemaNames
;
private
Collection
<
Table
>
tables
;
private
boolean
passwords
;
/** true if we're generating the INSERT..VALUES statements for row values */
private
boolean
data
;
private
boolean
settings
;
/** true if we're generating the DROP statements */
private
boolean
drop
;
private
boolean
simple
;
private
LocalResult
result
;
...
...
@@ -188,7 +190,8 @@ public class ScriptCommand extends ScriptBase {
Constant
constant
=
(
Constant
)
obj
;
add
(
constant
.
getCreateSQL
(),
false
);
}
ArrayList
<
Table
>
tables
=
db
.
getAllTablesAndViews
(
false
);
final
ArrayList
<
Table
>
tables
=
db
.
getAllTablesAndViews
(
false
);
// sort by id, so that views are after tables and views on views
// after the base views
Collections
.
sort
(
tables
,
new
Comparator
<
Table
>()
{
...
...
@@ -196,6 +199,8 @@ public class ScriptCommand extends ScriptBase {
return
t1
.
getId
()
-
t2
.
getId
();
}
});
// Generate the DROP XXX ... IF EXISTS
for
(
Table
table
:
tables
)
{
if
(
excludeSchema
(
table
.
getSchema
()))
{
continue
;
...
...
@@ -241,6 +246,8 @@ public class ScriptCommand extends ScriptBase {
}
add
(
sequence
.
getCreateSQL
(),
false
);
}
// Generate CREATE TABLE and INSERT...VALUES
int
count
=
0
;
for
(
Table
table
:
tables
)
{
if
(
excludeSchema
(
table
.
getSchema
()))
{
...
...
@@ -253,14 +260,14 @@ public class ScriptCommand extends ScriptBase {
continue
;
}
table
.
lock
(
session
,
false
,
false
);
String
s
ql
=
table
.
getCreateSQL
();
if
(
s
ql
==
null
)
{
String
createTableS
ql
=
table
.
getCreateSQL
();
if
(
createTableS
ql
==
null
)
{
// null for metadata tables
continue
;
}
String
tableType
=
table
.
getTableType
();
add
(
s
ql
,
false
);
ArrayList
<
Constraint
>
constraints
=
table
.
getConstraints
();
final
String
tableType
=
table
.
getTableType
();
add
(
createTableS
ql
,
false
);
final
ArrayList
<
Constraint
>
constraints
=
table
.
getConstraints
();
if
(
constraints
!=
null
)
{
for
(
Constraint
constraint
:
constraints
)
{
if
(
Constraint
.
PRIMARY_KEY
.
equals
(
constraint
.
getConstraintType
()))
{
...
...
@@ -349,7 +356,8 @@ public class ScriptCommand extends ScriptBase {
add
(
"DROP ALIAS IF EXISTS SYSTEM_COMBINE_BLOB"
,
true
);
tempLobTableCreated
=
false
;
}
ArrayList
<
SchemaObject
>
constraints
=
db
.
getAllSchemaObjects
(
DbObject
.
CONSTRAINT
);
// Generate CREATE CONSTRAINT ...
final
ArrayList
<
SchemaObject
>
constraints
=
db
.
getAllSchemaObjects
(
DbObject
.
CONSTRAINT
);
Collections
.
sort
(
constraints
,
new
Comparator
<
SchemaObject
>()
{
public
int
compare
(
SchemaObject
c1
,
SchemaObject
c2
)
{
return
((
Constraint
)
c1
).
compareTo
((
Constraint
)
c2
);
...
...
@@ -370,6 +378,7 @@ public class ScriptCommand extends ScriptBase {
add
(
constraint
.
getCreateSQLWithoutIndexes
(),
false
);
}
}
// Generate CREATE TRIGGER ...
for
(
SchemaObject
obj
:
db
.
getAllSchemaObjects
(
DbObject
.
TRIGGER
))
{
if
(
excludeSchema
(
obj
.
getSchema
()))
{
continue
;
...
...
@@ -380,6 +389,7 @@ public class ScriptCommand extends ScriptBase {
}
add
(
trigger
.
getCreateSQL
(),
false
);
}
// Generate GRANT ...
for
(
Right
right
:
db
.
getAllRights
())
{
Table
table
=
right
.
getGrantedTable
();
if
(
table
!=
null
)
{
...
...
@@ -392,6 +402,7 @@ public class ScriptCommand extends ScriptBase {
}
add
(
right
.
getCreateSQL
(),
false
);
}
// Generate COMMENT ON ...
for
(
Comment
comment
:
db
.
getAllComments
())
{
add
(
comment
.
getCreateSQL
(),
false
);
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论