Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
70d85741
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
70d85741
编写于
5月 26, 2016
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Object manager model refactoring (create/alter command)
Former-commit-id:
0a228919
上级
814999eb
变更
33
隐藏空白更改
内联
并排
Showing
33 changed file
with
171 addition
and
236 deletion
+171
-236
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2AbstractDropOnlyManager.java
...s/dbeaver/ext/db2/manager/DB2AbstractDropOnlyManager.java
+1
-2
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2ForeignKeyManager.java
...g/jkiss/dbeaver/ext/db2/manager/DB2ForeignKeyManager.java
+1
-1
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2SchemaManager.java
...c/org/jkiss/dbeaver/ext/db2/manager/DB2SchemaManager.java
+2
-2
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2SequenceManager.java
...org/jkiss/dbeaver/ext/db2/manager/DB2SequenceManager.java
+7
-16
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2TableColumnManager.java
.../jkiss/dbeaver/ext/db2/manager/DB2TableColumnManager.java
+7
-12
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2TableManager.java
...rc/org/jkiss/dbeaver/ext/db2/manager/DB2TableManager.java
+9
-25
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLCatalogManager.java
...org/jkiss/dbeaver/ext/mysql/edit/MySQLCatalogManager.java
+3
-3
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLProcedureManager.java
...g/jkiss/dbeaver/ext/mysql/edit/MySQLProcedureManager.java
+9
-9
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLTableColumnManager.java
...jkiss/dbeaver/ext/mysql/edit/MySQLTableColumnManager.java
+3
-3
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLTableManager.java
...c/org/jkiss/dbeaver/ext/mysql/edit/MySQLTableManager.java
+3
-3
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLViewManager.java
...rc/org/jkiss/dbeaver/ext/mysql/edit/MySQLViewManager.java
+6
-8
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleDataTypeManager.java
.../jkiss/dbeaver/ext/oracle/edit/OracleDataTypeManager.java
+9
-12
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleMaterializedViewManager.java
...beaver/ext/oracle/edit/OracleMaterializedViewManager.java
+9
-9
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OraclePackageManager.java
...g/jkiss/dbeaver/ext/oracle/edit/OraclePackageManager.java
+10
-13
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleProcedureManager.java
...jkiss/dbeaver/ext/oracle/edit/OracleProcedureManager.java
+9
-12
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleSchemaManager.java
...rg/jkiss/dbeaver/ext/oracle/edit/OracleSchemaManager.java
+3
-3
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleTableColumnManager.java
...iss/dbeaver/ext/oracle/edit/OracleTableColumnManager.java
+3
-6
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleTableManager.java
...org/jkiss/dbeaver/ext/oracle/edit/OracleTableManager.java
+4
-8
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleTriggerManager.java
...g/jkiss/dbeaver/ext/oracle/edit/OracleTriggerManager.java
+7
-10
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleViewManager.java
.../org/jkiss/dbeaver/ext/oracle/edit/OracleViewManager.java
+5
-7
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreDatabaseManager.java
...s/dbeaver/ext/postgresql/edit/PostgreDatabaseManager.java
+5
-6
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreProcedureManager.java
.../dbeaver/ext/postgresql/edit/PostgreProcedureManager.java
+9
-9
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreSchemaManager.java
...iss/dbeaver/ext/postgresql/edit/PostgreSchemaManager.java
+3
-3
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreTableColumnManager.java
...beaver/ext/postgresql/edit/PostgreTableColumnManager.java
+5
-8
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreTableManager.java
...kiss/dbeaver/ext/postgresql/edit/PostgreTableManager.java
+3
-7
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreViewManager.java
...jkiss/dbeaver/ext/postgresql/edit/PostgreViewManager.java
+8
-13
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/SQLObjectEditor.java
...rg/jkiss/dbeaver/model/impl/sql/edit/SQLObjectEditor.java
+8
-4
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/SQLStructEditor.java
...rg/jkiss/dbeaver/model/impl/sql/edit/SQLStructEditor.java
+4
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLConstraintManager.java
...aver/model/impl/sql/edit/struct/SQLConstraintManager.java
+3
-3
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLForeignKeyManager.java
...aver/model/impl/sql/edit/struct/SQLForeignKeyManager.java
+3
-3
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLIndexManager.java
...s/dbeaver/model/impl/sql/edit/struct/SQLIndexManager.java
+3
-3
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLTableColumnManager.java
...ver/model/impl/sql/edit/struct/SQLTableColumnManager.java
+3
-3
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLTableManager.java
...s/dbeaver/model/impl/sql/edit/struct/SQLTableManager.java
+4
-8
未找到文件。
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2AbstractDropOnlyManager.java
浏览文件 @
70d85741
...
...
@@ -70,9 +70,8 @@ public abstract class DB2AbstractDropOnlyManager<OBJECT_TYPE extends DBSObject &
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
return
null
;
}
}
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2ForeignKeyManager.java
浏览文件 @
70d85741
...
...
@@ -125,7 +125,7 @@ public class DB2ForeignKeyManager extends SQLForeignKeyManager<DB2TableForeignKe
// ------
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
// DF: Throw exception for now
// Will have to implement it for alter FK query optimisation + TRUST
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2SchemaManager.java
浏览文件 @
70d85741
...
...
@@ -81,11 +81,11 @@ public class DB2SchemaManager extends SQLObjectEditor<DB2Schema, DB2DataSource>
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
SQLDatabasePersistAction
action
=
new
SQLDatabasePersistAction
(
"Create schema"
,
String
.
format
(
SQL_CREATE_SCHEMA
,
DBUtils
.
getQuotedIdentifier
(
command
.
getObject
())));
return
new
DBEPersistAction
[]
{
action
}
;
actions
.
add
(
action
)
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2SequenceManager.java
浏览文件 @
70d85741
...
...
@@ -22,11 +22,11 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.ext.db2.DB2Messages
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Schema
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Sequence
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.impl.DBSObjectCache
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
import
org.jkiss.dbeaver.model.impl.sql.edit.SQLObjectEditor
;
...
...
@@ -34,7 +34,6 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import
org.jkiss.dbeaver.ui.dialogs.struct.CreateEntityDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -88,35 +87,27 @@ public class DB2SequenceManager extends SQLObjectEditor<DB2Sequence, DB2Schema>
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
List
<
DBEPersistAction
>
listeCommands
=
new
ArrayList
<>(
2
);
String
sql
=
buildStatement
(
command
.
getObject
(),
false
);
listeCommand
s
.
add
(
new
SQLDatabasePersistAction
(
"Create Sequence"
,
sql
));
action
s
.
add
(
new
SQLDatabasePersistAction
(
"Create Sequence"
,
sql
));
String
comment
=
buildComment
(
command
.
getObject
());
if
(
comment
!=
null
)
{
listeCommand
s
.
add
(
new
SQLDatabasePersistAction
(
"Comment on Sequence"
,
comment
));
action
s
.
add
(
new
SQLDatabasePersistAction
(
"Comment on Sequence"
,
comment
));
}
return
listeCommands
.
toArray
(
new
DBEPersistAction
[
listeCommands
.
size
()]);
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
List
<
DBEPersistAction
>
listeActions
=
new
ArrayList
<>(
2
);
String
sql
=
buildStatement
(
command
.
getObject
(),
true
);
listeActions
.
add
(
new
SQLDatabasePersistAction
(
"Alter Sequence"
,
sql
));
actionList
.
add
(
new
SQLDatabasePersistAction
(
"Alter Sequence"
,
sql
));
String
comment
=
buildComment
(
command
.
getObject
());
if
(
comment
!=
null
)
{
listeActions
.
add
(
new
SQLDatabasePersistAction
(
"Comment on Sequence"
,
comment
));
actionList
.
add
(
new
SQLDatabasePersistAction
(
"Comment on Sequence"
,
comment
));
}
return
listeActions
.
toArray
(
new
DBEPersistAction
[
listeActions
.
size
()]);
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2TableColumnManager.java
浏览文件 @
70d85741
...
...
@@ -20,13 +20,13 @@ package org.jkiss.dbeaver.ext.db2.manager;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.edit.DBEObjectRenamer
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.ext.db2.model.DB2TableBase
;
import
org.jkiss.dbeaver.ext.db2.model.DB2TableColumn
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEObjectRenamer
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.impl.DBSObjectCache
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
import
org.jkiss.dbeaver.model.impl.sql.edit.struct.SQLTableColumnManager
;
...
...
@@ -34,7 +34,6 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -98,34 +97,30 @@ public class DB2TableColumnManager extends SQLTableColumnManager<DB2TableColumn,
// Alter
// -----
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
DB2TableColumn
db2Column
=
command
.
getObject
();
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>(
3
);
boolean
hasColumnChanges
=
false
;
if
(!
command
.
getProperties
().
isEmpty
())
{
final
String
deltaSQL
=
computeDeltaSQL
(
command
);
if
(!
deltaSQL
.
isEmpty
())
{
hasColumnChanges
=
true
;
String
sqlAlterColumn
=
String
.
format
(
SQL_ALTER
,
db2Column
.
getTable
().
getFullQualifiedName
(),
deltaSQL
);
action
s
.
add
(
new
SQLDatabasePersistAction
(
CMD_ALTER
,
sqlAlterColumn
));
action
List
.
add
(
new
SQLDatabasePersistAction
(
CMD_ALTER
,
sqlAlterColumn
));
}
}
// Comment
DBEPersistAction
commentAction
=
buildCommentAction
(
db2Column
);
if
(
commentAction
!=
null
)
{
action
s
.
add
(
commentAction
);
action
List
.
add
(
commentAction
);
}
if
(
hasColumnChanges
)
{
// Be Safe, Add a reorg action
action
s
.
add
(
buildReorgAction
(
db2Column
));
action
List
.
add
(
buildReorgAction
(
db2Column
));
}
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
// -------
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/manager/DB2TableManager.java
浏览文件 @
70d85741
...
...
@@ -20,16 +20,10 @@ package org.jkiss.dbeaver.ext.db2.manager;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Index
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Schema
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Table
;
import
org.jkiss.dbeaver.ext.db2.model.DB2TableColumn
;
import
org.jkiss.dbeaver.ext.db2.model.DB2TableForeignKey
;
import
org.jkiss.dbeaver.ext.db2.model.DB2TableUniqueKey
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Tablespace
;
import
org.jkiss.dbeaver.ext.db2.model.*
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEObjectRenamer
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.impl.DBSObjectCache
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
import
org.jkiss.dbeaver.model.impl.sql.edit.struct.SQLTableManager
;
...
...
@@ -37,8 +31,6 @@ import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
/**
...
...
@@ -142,17 +134,13 @@ public class DB2TableManager extends SQLTableManager<DB2Table, DB2Schema> implem
}
@Override
public
DBEPersistAction
[]
makeStructObjectCreateActions
(
StructCreateCommand
command
)
public
void
addStructObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
StructCreateCommand
command
)
{
super
.
addStructObjectCreateActions
(
actions
,
command
);
// Eventually add Comment
DBEPersistAction
commentAction
=
buildCommentAction
(
command
.
getObject
());
if
(
commentAction
==
null
)
{
return
super
.
makeStructObjectCreateActions
(
command
);
}
else
{
List
<
DBEPersistAction
>
actionList
=
new
ArrayList
<>(
Arrays
.
asList
(
super
.
makeStructObjectCreateActions
(
command
)));
actionList
.
add
(
commentAction
);
return
actionList
.
toArray
(
new
DBEPersistAction
[
actionList
.
size
()]);
if
(
commentAction
!=
null
)
{
actions
.
add
(
commentAction
);
}
}
...
...
@@ -161,12 +149,10 @@ public class DB2TableManager extends SQLTableManager<DB2Table, DB2Schema> implem
// ------
@Override
public
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
public
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
DB2Table
db2Table
=
command
.
getObject
();
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>(
2
);
if
(
command
.
getProperties
().
size
()
>
1
)
{
StringBuilder
sb
=
new
StringBuilder
(
128
);
sb
.
append
(
SQL_ALTER
);
...
...
@@ -175,15 +161,13 @@ public class DB2TableManager extends SQLTableManager<DB2Table, DB2Schema> implem
appendTableModifiers
(
command
.
getObject
(),
command
,
sb
);
action
s
.
add
(
new
SQLDatabasePersistAction
(
CMD_ALTER
,
sb
.
toString
()));
action
List
.
add
(
new
SQLDatabasePersistAction
(
CMD_ALTER
,
sb
.
toString
()));
}
DBEPersistAction
commentAction
=
buildCommentAction
(
db2Table
);
if
(
commentAction
!=
null
)
{
action
s
.
add
(
commentAction
);
action
List
.
add
(
commentAction
);
}
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
// ------
...
...
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLCatalogManager.java
浏览文件 @
70d85741
...
...
@@ -68,7 +68,7 @@ public class MySQLCatalogManager extends SQLObjectEditor<MySQLCatalog, MySQLData
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
final
MySQLCatalog
catalog
=
command
.
getObject
();
final
StringBuilder
script
=
new
StringBuilder
(
"CREATE SCHEMA `"
+
catalog
.
getName
()
+
"`"
);
...
...
@@ -78,9 +78,9 @@ public class MySQLCatalogManager extends SQLObjectEditor<MySQLCatalog, MySQLData
if
(
catalog
.
getDefaultCollation
()
!=
null
)
{
script
.
append
(
"\nDEFAULT COLLATE "
).
append
(
catalog
.
getDefaultCollation
().
getName
());
}
return
new
DBEPersistAction
[]
{
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create schema"
,
script
.
toString
())
//$NON-NLS-2$
}
;
)
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLProcedureManager.java
浏览文件 @
70d85741
...
...
@@ -78,15 +78,15 @@ public class MySQLProcedureManager extends SQLObjectEditor<MySQLProcedure, MySQL
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
return
createOrReplaceProcedureQuery
(
command
.
getObject
());
createOrReplaceProcedureQuery
(
actions
,
command
.
getObject
());
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
return
createOrReplaceProcedureQuery
(
command
.
getObject
());
createOrReplaceProcedureQuery
(
actionList
,
command
.
getObject
());
}
@Override
...
...
@@ -97,12 +97,12 @@ public class MySQLProcedureManager extends SQLObjectEditor<MySQLProcedure, MySQL
);
}
private
DBEPersistAction
[]
createOrReplaceProcedureQuery
(
MySQLProcedure
procedure
)
private
void
createOrReplaceProcedureQuery
(
List
<
DBEPersistAction
>
actions
,
MySQLProcedure
procedure
)
{
return
new
DBEPersistAction
[]
{
new
SQLDatabasePersistAction
(
"Drop procedure"
,
"DROP "
+
procedure
.
getProcedureType
()
+
" IF EXISTS "
+
procedure
.
getFullQualifiedName
())
,
//$NON-NLS-2$ //$NON-NLS-3$
new
SQLDatabasePersistAction
(
"Create procedure"
,
procedure
.
getDeclaration
())
//$NON-NLS-2$
}
;
actions
.
add
(
new
SQLDatabasePersistAction
(
"Drop procedure"
,
"DROP "
+
procedure
.
getProcedureType
()
+
" IF EXISTS "
+
procedure
.
getFullQualifiedName
())
);
//$NON-NLS-2$ //$NON-NLS-3$
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create procedure"
,
procedure
.
getDeclaration
()))
;
}
}
...
...
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLTableColumnManager.java
浏览文件 @
70d85741
...
...
@@ -105,14 +105,14 @@ public class MySQLTableColumnManager extends SQLTableColumnManager<MySQLTableCol
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
final
MySQLTableColumn
column
=
command
.
getObject
();
return
new
DBEPersistAction
[]
{
actionList
.
add
(
new
SQLDatabasePersistAction
(
"Modify column"
,
"ALTER TABLE "
+
column
.
getTable
().
getFullQualifiedName
()
+
" MODIFY COLUMN "
+
getNestedDeclaration
(
column
.
getTable
(),
command
))
}
;
//$NON-NLS-1$ //$NON-NLS-2$
"ALTER TABLE "
+
column
.
getTable
().
getFullQualifiedName
()
+
" MODIFY COLUMN "
+
getNestedDeclaration
(
column
.
getTable
(),
command
))
)
;
//$NON-NLS-1$ //$NON-NLS-2$
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLTableManager.java
浏览文件 @
70d85741
...
...
@@ -73,15 +73,15 @@ public class MySQLTableManager extends SQLTableManager<MySQLTableBase, MySQLCata
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
StringBuilder
query
=
new
StringBuilder
(
"ALTER TABLE "
);
//$NON-NLS-1$
query
.
append
(
command
.
getObject
().
getFullQualifiedName
()).
append
(
" "
);
//$NON-NLS-1$
appendTableModifiers
(
command
.
getObject
(),
command
,
query
);
return
new
DBEPersistAction
[]
{
actionList
.
add
(
new
SQLDatabasePersistAction
(
query
.
toString
())
}
;
)
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/edit/MySQLViewManager.java
浏览文件 @
70d85741
...
...
@@ -73,15 +73,15 @@ public class MySQLViewManager extends SQLObjectEditor<MySQLTableBase, MySQLCatal
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
return
createOrReplaceViewQuery
(
(
MySQLView
)
command
.
getObject
());
createOrReplaceViewQuery
(
actions
,
(
MySQLView
)
command
.
getObject
());
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
return
createOrReplaceViewQuery
(
(
MySQLView
)
command
.
getObject
());
createOrReplaceViewQuery
(
actionList
,
(
MySQLView
)
command
.
getObject
());
}
@Override
...
...
@@ -92,7 +92,7 @@ public class MySQLViewManager extends SQLObjectEditor<MySQLTableBase, MySQLCatal
);
}
private
DBEPersistAction
[]
createOrReplaceViewQuery
(
MySQLView
view
)
private
void
createOrReplaceViewQuery
(
List
<
DBEPersistAction
>
actions
,
MySQLView
view
)
{
StringBuilder
decl
=
new
StringBuilder
(
200
);
final
String
lineSeparator
=
GeneralUtils
.
getDefaultLineSeparator
();
...
...
@@ -102,9 +102,7 @@ public class MySQLViewManager extends SQLObjectEditor<MySQLTableBase, MySQLCatal
if
(
checkOption
!=
null
&&
checkOption
!=
MySQLView
.
CheckOption
.
NONE
)
{
decl
.
append
(
lineSeparator
).
append
(
"WITH "
).
append
(
checkOption
.
getDefinitionName
()).
append
(
" CHECK OPTION"
);
//$NON-NLS-1$ //$NON-NLS-2$
}
return
new
DBEPersistAction
[]
{
new
SQLDatabasePersistAction
(
"Create view"
,
decl
.
toString
())
};
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create view"
,
decl
.
toString
()));
}
/*
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleDataTypeManager.java
浏览文件 @
70d85741
...
...
@@ -21,12 +21,12 @@ package org.jkiss.dbeaver.ext.oracle.edit;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.ext.oracle.OracleMessages
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleDataType
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleSchema
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleUtils
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.impl.DBSObjectCache
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
import
org.jkiss.dbeaver.model.impl.sql.edit.SQLObjectEditor
;
...
...
@@ -34,7 +34,6 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import
org.jkiss.dbeaver.ui.dialogs.struct.CreateEntityDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -67,9 +66,9 @@ public class OracleDataTypeManager extends SQLObjectEditor<OracleDataType, Oracl
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
objectCreateCommand
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
objectCreateCommand
)
{
return
createOrReplaceProcedureQuery
(
objectCreateCommand
.
getObject
());
createOrReplaceProcedureQuery
(
actions
,
objectCreateCommand
.
getObject
());
}
@Override
...
...
@@ -83,9 +82,9 @@ public class OracleDataTypeManager extends SQLObjectEditor<OracleDataType, Oracl
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
objectChangeCommand
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
objectChangeCommand
)
{
return
createOrReplaceProcedureQuery
(
objectChangeCommand
.
getObject
());
createOrReplaceProcedureQuery
(
actionList
,
objectChangeCommand
.
getObject
());
}
@Override
...
...
@@ -94,25 +93,23 @@ public class OracleDataTypeManager extends SQLObjectEditor<OracleDataType, Oracl
return
FEATURE_EDITOR_ON_CREATE
;
}
private
DBEPersistAction
[]
createOrReplaceProcedureQuery
(
OracleDataType
dataType
)
private
void
createOrReplaceProcedureQuery
(
List
<
DBEPersistAction
>
actionList
,
OracleDataType
dataType
)
{
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>();
String
header
=
OracleUtils
.
normalizeSourceName
(
dataType
,
false
);
if
(!
CommonUtils
.
isEmpty
(
header
))
{
action
s
.
add
(
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Create type header"
,
"CREATE OR REPLACE "
+
header
));
//$NON-NLS-1$
}
String
body
=
OracleUtils
.
normalizeSourceName
(
dataType
,
true
);
if
(!
CommonUtils
.
isEmpty
(
body
))
{
action
s
.
add
(
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Create type body"
,
"CREATE OR REPLACE "
+
body
));
//$NON-NLS-1$
}
OracleUtils
.
addSchemaChangeActions
(
actions
,
dataType
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
OracleUtils
.
addSchemaChangeActions
(
actionList
,
dataType
);
}
}
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleMaterializedViewManager.java
浏览文件 @
70d85741
...
...
@@ -71,15 +71,15 @@ public class OracleMaterializedViewManager extends SQLObjectEditor<OracleMateria
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
return
createOrReplaceViewQuery
(
command
.
getObject
());
createOrReplaceViewQuery
(
actions
,
command
.
getObject
());
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
return
createOrReplaceViewQuery
(
command
.
getObject
());
createOrReplaceViewQuery
(
actionList
,
command
.
getObject
());
}
@Override
...
...
@@ -90,16 +90,16 @@ public class OracleMaterializedViewManager extends SQLObjectEditor<OracleMateria
);
}
private
DBEPersistAction
[]
createOrReplaceViewQuery
(
OracleMaterializedView
view
)
private
void
createOrReplaceViewQuery
(
List
<
DBEPersistAction
>
actions
,
OracleMaterializedView
view
)
{
StringBuilder
decl
=
new
StringBuilder
(
200
);
final
String
lineSeparator
=
GeneralUtils
.
getDefaultLineSeparator
();
decl
.
append
(
"CREATE MATERIALIZED VIEW "
).
append
(
view
.
getFullQualifiedName
()).
append
(
lineSeparator
)
//$NON-NLS-1$
.
append
(
"AS "
).
append
(
view
.
getObjectDefinitionText
(
null
));
//$NON-NLS-1$
return
new
DBEPersistAction
[]
{
new
SQLDatabasePersistAction
(
"Drop view"
,
"DROP MATERIALIZED VIEW "
+
view
.
getFullQualifiedName
())
,
//$NON-NLS-2$
new
SQLDatabasePersistAction
(
"Create view"
,
decl
.
toString
())
}
;
actions
.
add
(
new
SQLDatabasePersistAction
(
"Drop view"
,
"DROP MATERIALIZED VIEW "
+
view
.
getFullQualifiedName
())
);
//$NON-NLS-2$
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create view"
,
decl
.
toString
()))
;
}
}
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OraclePackageManager.java
浏览文件 @
70d85741
...
...
@@ -22,12 +22,12 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.ext.oracle.OracleMessages
;
import
org.jkiss.dbeaver.ext.oracle.model.OraclePackage
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleSchema
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleUtils
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.impl.DBSObjectCache
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
import
org.jkiss.dbeaver.model.impl.sql.edit.SQLObjectEditor
;
...
...
@@ -36,7 +36,6 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import
org.jkiss.dbeaver.ui.dialogs.struct.CreateEntityDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -64,9 +63,9 @@ public class OraclePackageManager extends SQLObjectEditor<OraclePackage, OracleS
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
objectCreateCommand
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
objectCreateCommand
)
{
return
createOrReplaceProcedureQuery
(
objectCreateCommand
.
getObject
());
createOrReplaceProcedureQuery
(
actions
,
objectCreateCommand
.
getObject
());
}
@Override
...
...
@@ -80,9 +79,9 @@ public class OraclePackageManager extends SQLObjectEditor<OraclePackage, OracleS
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
objectChangeCommand
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
objectChangeCommand
)
{
return
createOrReplaceProcedureQuery
(
objectChangeCommand
.
getObject
());
createOrReplaceProcedureQuery
(
actionList
,
objectChangeCommand
.
getObject
());
}
@Override
...
...
@@ -91,25 +90,24 @@ public class OraclePackageManager extends SQLObjectEditor<OraclePackage, OracleS
return
FEATURE_EDITOR_ON_CREATE
;
}
private
DBEPersistAction
[]
createOrReplaceProcedureQuery
(
OraclePackage
pack
)
private
void
createOrReplaceProcedureQuery
(
List
<
DBEPersistAction
>
actionList
,
OraclePackage
pack
)
{
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>();
try
{
String
header
=
pack
.
getObjectDefinitionText
(
VoidProgressMonitor
.
INSTANCE
);
if
(!
CommonUtils
.
isEmpty
(
header
))
{
action
s
.
add
(
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Create package header"
,
header
));
//$NON-NLS-1$
}
String
body
=
pack
.
getObjectBodyDefinitionText
(
VoidProgressMonitor
.
INSTANCE
);
if
(!
CommonUtils
.
isEmpty
(
body
))
{
action
s
.
add
(
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Create package body"
,
body
));
//$NON-NLS-1$
}
else
{
action
s
.
add
(
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Drop package header"
,
"DROP PACKAGE BODY "
+
pack
.
getFullQualifiedName
(),
DBEPersistAction
.
ActionType
.
OPTIONAL
)
//$NON-NLS-1$
...
...
@@ -118,8 +116,7 @@ public class OraclePackageManager extends SQLObjectEditor<OraclePackage, OracleS
}
catch
(
DBException
e
)
{
log
.
warn
(
e
);
}
OracleUtils
.
addSchemaChangeActions
(
actions
,
pack
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
OracleUtils
.
addSchemaChangeActions
(
actionList
,
pack
);
}
}
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleProcedureManager.java
浏览文件 @
70d85741
...
...
@@ -21,18 +21,17 @@ package org.jkiss.dbeaver.ext.oracle.edit;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleProcedureStandalone
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleSchema
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleUtils
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.impl.DBSObjectCache
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
import
org.jkiss.dbeaver.model.impl.sql.edit.SQLObjectEditor
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.ui.dialogs.struct.CreateProcedureDialog
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -61,9 +60,9 @@ public class OracleProcedureManager extends SQLObjectEditor<OracleProcedureStand
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
objectCreateCommand
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
objectCreateCommand
)
{
return
createOrReplaceProcedureQuery
(
objectCreateCommand
.
getObject
());
createOrReplaceProcedureQuery
(
actions
,
objectCreateCommand
.
getObject
());
}
@Override
...
...
@@ -77,9 +76,9 @@ public class OracleProcedureManager extends SQLObjectEditor<OracleProcedureStand
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
objectChangeCommand
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
objectChangeCommand
)
{
return
createOrReplaceProcedureQuery
(
objectChangeCommand
.
getObject
());
createOrReplaceProcedureQuery
(
actionList
,
objectChangeCommand
.
getObject
());
}
@Override
...
...
@@ -88,16 +87,14 @@ public class OracleProcedureManager extends SQLObjectEditor<OracleProcedureStand
return
FEATURE_EDITOR_ON_CREATE
;
}
private
DBEPersistAction
[]
createOrReplaceProcedureQuery
(
OracleProcedureStandalone
procedure
)
private
void
createOrReplaceProcedureQuery
(
List
<
DBEPersistAction
>
actionList
,
OracleProcedureStandalone
procedure
)
{
String
source
=
OracleUtils
.
normalizeSourceName
(
procedure
,
false
);
if
(
source
==
null
)
{
return
null
;
return
;
}
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>();
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create procedure"
,
source
));
//$NON-NLS-2$
OracleUtils
.
addSchemaChangeActions
(
actions
,
procedure
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
actionList
.
add
(
new
SQLDatabasePersistAction
(
"Create procedure"
,
source
));
//$NON-NLS-2$
OracleUtils
.
addSchemaChangeActions
(
actionList
,
procedure
);
}
}
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleSchemaManager.java
浏览文件 @
70d85741
...
...
@@ -77,13 +77,13 @@ public class OracleSchemaManager extends SQLObjectEditor<OracleSchema, OracleDat
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
OracleUser
user
=
command
.
getObject
().
getUser
();
return
new
DBEPersistAction
[]
{
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create schema"
,
"CREATE USER "
+
DBUtils
.
getQuotedIdentifier
(
user
)
+
" IDENTIFIED BY \""
+
user
.
getPassword
()
+
"\""
)
}
;
)
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleTableColumnManager.java
浏览文件 @
70d85741
...
...
@@ -36,7 +36,6 @@ import org.jkiss.dbeaver.model.struct.DBSDataType;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
java.sql.Types
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -72,24 +71,22 @@ public class OracleTableColumnManager extends SQLTableColumnManager<OracleTableC
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
final
OracleTableColumn
column
=
command
.
getObject
();
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>(
2
);
boolean
hasComment
=
command
.
getProperty
(
"comment"
)
!=
null
;
if
(!
hasComment
||
command
.
getProperties
().
size
()
>
1
)
{
action
s
.
add
(
new
SQLDatabasePersistAction
(
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Modify column"
,
"ALTER TABLE "
+
column
.
getTable
().
getFullQualifiedName
()
+
//$NON-NLS-1$
" MODIFY "
+
getNestedDeclaration
(
column
.
getTable
(),
command
)));
//$NON-NLS-1$
}
if
(
hasComment
)
{
action
s
.
add
(
new
SQLDatabasePersistAction
(
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Comment column"
,
"COMMENT ON COLUMN "
+
column
.
getTable
().
getFullQualifiedName
()
+
"."
+
DBUtils
.
getQuotedIdentifier
(
column
)
+
" IS '"
+
column
.
getComment
(
VoidProgressMonitor
.
INSTANCE
)
+
"'"
));
}
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleTableManager.java
浏览文件 @
70d85741
...
...
@@ -20,18 +20,17 @@ package org.jkiss.dbeaver.ext.oracle.edit;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.ext.oracle.model.*
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEObjectRenamer
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.impl.DBSObjectCache
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
import
org.jkiss.dbeaver.model.impl.sql.edit.struct.SQLTableManager
;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -66,18 +65,15 @@ public class OracleTableManager extends SQLTableManager<OracleTable, OracleSchem
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>(
2
);
if
(
command
.
getProperties
().
size
()
>
1
||
command
.
getProperty
(
"comment"
)
==
null
)
{
StringBuilder
query
=
new
StringBuilder
(
"ALTER TABLE "
);
//$NON-NLS-1$
query
.
append
(
command
.
getObject
().
getFullQualifiedName
()).
append
(
" "
);
//$NON-NLS-1$
appendTableModifiers
(
command
.
getObject
(),
command
,
query
);
action
s
.
add
(
new
SQLDatabasePersistAction
(
query
.
toString
()));
action
List
.
add
(
new
SQLDatabasePersistAction
(
query
.
toString
()));
}
addObjectExtraActions
(
actions
,
command
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
addObjectExtraActions
(
actionList
,
command
);
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleTriggerManager.java
浏览文件 @
70d85741
...
...
@@ -22,12 +22,12 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.ext.oracle.OracleMessages
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleTableBase
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleTrigger
;
import
org.jkiss.dbeaver.ext.oracle.model.OracleUtils
;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.impl.DBSObjectCache
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
import
org.jkiss.dbeaver.model.impl.sql.edit.SQLObjectEditor
;
...
...
@@ -35,7 +35,6 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import
org.jkiss.dbeaver.ui.dialogs.struct.CreateEntityDialog
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -80,15 +79,15 @@ public class OracleTriggerManager extends SQLObjectEditor<OracleTrigger, OracleT
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
return
createOrReplaceViewQuery
(
command
.
getObject
());
createOrReplaceViewQuery
(
actions
,
command
.
getObject
());
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
return
createOrReplaceViewQuery
(
command
.
getObject
());
createOrReplaceViewQuery
(
actionList
,
command
.
getObject
());
}
@Override
...
...
@@ -99,16 +98,14 @@ public class OracleTriggerManager extends SQLObjectEditor<OracleTrigger, OracleT
);
}
private
DBEPersistAction
[]
createOrReplaceViewQuery
(
OracleTrigger
trigger
)
private
void
createOrReplaceViewQuery
(
List
<
DBEPersistAction
>
actions
,
OracleTrigger
trigger
)
{
String
source
=
OracleUtils
.
normalizeSourceName
(
trigger
,
false
);
if
(
source
==
null
)
{
return
null
;
return
;
}
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>();
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create trigger"
,
"CREATE OR REPLACE "
+
source
));
//$NON-NLS-2$
OracleUtils
.
addSchemaChangeActions
(
actions
,
trigger
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
}
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/edit/OracleViewManager.java
浏览文件 @
70d85741
...
...
@@ -73,15 +73,15 @@ public class OracleViewManager extends SQLObjectEditor<OracleView, OracleSchema>
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
return
createOrReplaceViewQuery
(
command
);
createOrReplaceViewQuery
(
actions
,
command
);
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
return
createOrReplaceViewQuery
(
command
);
createOrReplaceViewQuery
(
actionList
,
command
);
}
@Override
...
...
@@ -92,11 +92,10 @@ public class OracleViewManager extends SQLObjectEditor<OracleView, OracleSchema>
);
}
private
DBEPersistAction
[]
createOrReplaceViewQuery
(
DBECommandComposite
<
OracleView
,
PropertyHandler
>
command
)
private
void
createOrReplaceViewQuery
(
List
<
DBEPersistAction
>
actions
,
DBECommandComposite
<
OracleView
,
PropertyHandler
>
command
)
{
final
OracleView
view
=
command
.
getObject
();
boolean
hasComment
=
command
.
getProperty
(
"comment"
)
!=
null
;
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>(
2
);
if
(!
hasComment
||
command
.
getProperties
().
size
()
>
1
)
{
StringBuilder
decl
=
new
StringBuilder
(
200
);
final
String
lineSeparator
=
GeneralUtils
.
getDefaultLineSeparator
();
...
...
@@ -110,7 +109,6 @@ public class OracleViewManager extends SQLObjectEditor<OracleView, OracleSchema>
"COMMENT ON TABLE "
+
view
.
getFullQualifiedName
()
+
" IS '"
+
view
.
getComment
()
+
"'"
));
}
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreDatabaseManager.java
浏览文件 @
70d85741
...
...
@@ -63,20 +63,19 @@ public class PostgreDatabaseManager extends SQLObjectEditor<PostgreDatabase, Pos
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
final
PostgreDatabase
database
=
command
.
getObject
();
final
StringBuilder
script
=
new
StringBuilder
(
"CREATE DATABASE "
+
DBUtils
.
getQuotedIdentifier
(
database
));
return
new
DBEPersistAction
[]
{
new
SQLDatabasePersistAction
(
"Create database"
,
script
.
toString
())
//$NON-NLS-2$
};
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create database"
,
"CREATE DATABASE "
+
DBUtils
.
getQuotedIdentifier
(
database
))
//$NON-NLS-2$
);
}
@Override
protected
void
addObjectDeleteActions
(
List
<
DBEPersistAction
>
actions
,
ObjectDeleteCommand
command
)
{
actions
.
add
(
new
SQLDatabasePersistAction
(
"Drop database"
,
"DROP
SCHEMA
"
+
DBUtils
.
getQuotedIdentifier
(
command
.
getObject
()))
//$NON-NLS-2$
new
SQLDatabasePersistAction
(
"Drop database"
,
"DROP
DATABASE
"
+
DBUtils
.
getQuotedIdentifier
(
command
.
getObject
()))
//$NON-NLS-2$
);
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreProcedureManager.java
浏览文件 @
70d85741
...
...
@@ -76,15 +76,15 @@ public class PostgreProcedureManager extends SQLObjectEditor<PostgreProcedure, P
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
return
createOrReplaceProcedureQuery
(
command
.
getObject
());
createOrReplaceProcedureQuery
(
actions
,
command
.
getObject
());
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
return
createOrReplaceProcedureQuery
(
command
.
getObject
());
createOrReplaceProcedureQuery
(
actionList
,
command
.
getObject
());
}
@Override
...
...
@@ -96,13 +96,13 @@ public class PostgreProcedureManager extends SQLObjectEditor<PostgreProcedure, P
);
}
private
DBEPersistAction
[]
createOrReplaceProcedureQuery
(
PostgreProcedure
procedure
)
private
void
createOrReplaceProcedureQuery
(
List
<
DBEPersistAction
>
actions
,
PostgreProcedure
procedure
)
{
String
objectType
=
procedure
.
isAggregate
()
?
"AGGREGATE"
:
"FUNCTION"
;
return
new
DBEPersistAction
[]
{
new
SQLDatabasePersistAction
(
"Drop procedure"
,
"DROP "
+
objectType
+
" IF EXISTS "
+
procedure
.
getFullQualifiedSignature
())
,
//$NON-NLS-2$ //$NON-NLS-3$
new
SQLDatabasePersistAction
(
"Create procedure"
,
procedure
.
getBody
())
//$NON-NLS-2$
}
;
actions
.
add
(
new
SQLDatabasePersistAction
(
"Drop procedure"
,
"DROP "
+
objectType
+
" IF EXISTS "
+
procedure
.
getFullQualifiedSignature
())
);
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create procedure"
,
procedure
.
getBody
()))
;
}
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreSchemaManager.java
浏览文件 @
70d85741
...
...
@@ -65,7 +65,7 @@ public class PostgreSchemaManager extends SQLObjectEditor<PostgreSchema, Postgre
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
final
PostgreSchema
schema
=
command
.
getObject
();
final
StringBuilder
script
=
new
StringBuilder
(
"CREATE SCHEMA "
+
DBUtils
.
getQuotedIdentifier
(
schema
));
...
...
@@ -78,9 +78,9 @@ public class PostgreSchemaManager extends SQLObjectEditor<PostgreSchema, Postgre
log
.
error
(
e
);
}
return
new
DBEPersistAction
[]
{
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create schema"
,
script
.
toString
())
//$NON-NLS-2$
}
;
)
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreTableColumnManager.java
浏览文件 @
70d85741
...
...
@@ -34,7 +34,6 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.Types
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -125,7 +124,7 @@ public class PostgreTableColumnManager extends SQLTableColumnManager<PostgreTabl
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
final
PostgreAttribute
column
=
command
.
getObject
();
// PostgreSQL can't perform all changes by one query
...
...
@@ -138,15 +137,13 @@ public class PostgreTableColumnManager extends SQLTableColumnManager<PostgreTabl
// ALTER [ COLUMN ] column RESET ( attribute_option [, ... ] )
// ALTER [ COLUMN ] column SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
String
prefix
=
"ALTER TABLE "
+
DBUtils
.
getObjectFullName
(
column
.
getTable
())
+
" ALTER COLUMN "
+
DBUtils
.
getQuotedIdentifier
(
column
)
+
" "
;
List
<
SQLDatabasePersistAction
>
actions
=
new
ArrayList
<>();
actions
.
add
(
new
SQLDatabasePersistAction
(
"Set column type"
,
prefix
+
"TYPE "
+
column
.
getFullQualifiedTypeName
()));
actions
.
add
(
new
SQLDatabasePersistAction
(
"Set column nullability"
,
prefix
+
(
column
.
isRequired
()
?
"SET"
:
"DROP"
)
+
" NOT NULL"
));
actionList
.
add
(
new
SQLDatabasePersistAction
(
"Set column type"
,
prefix
+
"TYPE "
+
column
.
getFullQualifiedTypeName
()));
actionList
.
add
(
new
SQLDatabasePersistAction
(
"Set column nullability"
,
prefix
+
(
column
.
isRequired
()
?
"SET"
:
"DROP"
)
+
" NOT NULL"
));
if
(
CommonUtils
.
isEmpty
(
column
.
getDefaultValue
()))
{
action
s
.
add
(
new
SQLDatabasePersistAction
(
"Drop column default"
,
prefix
+
"DROP DEFAULT"
));
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Drop column default"
,
prefix
+
"DROP DEFAULT"
));
}
else
{
action
s
.
add
(
new
SQLDatabasePersistAction
(
"Set column default"
,
prefix
+
"SET DEFAULT "
+
column
.
getDefaultValue
()));
action
List
.
add
(
new
SQLDatabasePersistAction
(
"Set column default"
,
prefix
+
"SET DEFAULT "
+
column
.
getDefaultValue
()));
}
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreTableManager.java
浏览文件 @
70d85741
...
...
@@ -32,7 +32,6 @@ import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -69,20 +68,17 @@ public class PostgreTableManager extends SQLTableManager<PostgreTableBase, Postg
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
final
PostgreTableBase
table
=
command
.
getObject
();
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>(
2
);
if
(
command
.
getProperties
().
size
()
>
1
||
command
.
getProperty
(
"description"
)
==
null
)
{
StringBuilder
query
=
new
StringBuilder
(
"ALTER TABLE "
);
//$NON-NLS-1$
query
.
append
(
table
.
getFullQualifiedName
()).
append
(
" "
);
//$NON-NLS-1$
appendTableModifiers
(
table
,
command
,
query
);
action
s
.
add
(
new
SQLDatabasePersistAction
(
query
.
toString
()));
action
List
.
add
(
new
SQLDatabasePersistAction
(
query
.
toString
()));
}
addObjectExtraActions
(
actions
,
command
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
addObjectExtraActions
(
actionList
,
command
);
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreViewManager.java
浏览文件 @
70d85741
...
...
@@ -72,15 +72,15 @@ public class PostgreViewManager extends SQLObjectEditor<PostgreTableBase, Postgr
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
return
createOrReplaceViewQuery
(
(
PostgreView
)
command
.
getObject
());
createOrReplaceViewQuery
(
actions
,
(
PostgreView
)
command
.
getObject
());
}
@Override
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
return
createOrReplaceViewQuery
(
(
PostgreView
)
command
.
getObject
());
createOrReplaceViewQuery
(
actionList
,
(
PostgreView
)
command
.
getObject
());
}
@Override
...
...
@@ -91,21 +91,16 @@ public class PostgreViewManager extends SQLObjectEditor<PostgreTableBase, Postgr
);
}
private
DBEPersistAction
[]
createOrReplaceViewQuery
(
PostgreView
view
)
private
void
createOrReplaceViewQuery
(
List
<
DBEPersistAction
>
actions
,
PostgreView
view
)
{
StringBuilder
decl
=
new
StringBuilder
(
200
);
final
String
lineSeparator
=
GeneralUtils
.
getDefaultLineSeparator
();
decl
.
append
(
"CREATE OR REPLACE VIEW "
).
append
(
view
.
getFullQualifiedName
()).
append
(
lineSeparator
)
//$NON-NLS-1$
.
append
(
"AS "
).
append
(
view
.
getSource
());
//$NON-NLS-1$
/*
final PostgreView.CheckOption checkOption = view.getAdditionalInfo().getCheckOption();
if (checkOption != null && checkOption != PostgreView.CheckOption.NONE) {
decl.append(lineSeparator).append("WITH ").append(checkOption.getDefinitionName()).append(" CHECK OPTION"); //$NON-NLS-1$ //$NON-NLS-2$
}
*/
return
new
DBEPersistAction
[]
{
actions
.
add
(
new
SQLDatabasePersistAction
(
"Create view"
,
decl
.
toString
())
}
;
)
;
}
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/SQLObjectEditor.java
浏览文件 @
70d85741
...
...
@@ -119,9 +119,9 @@ public abstract class SQLObjectEditor<OBJECT_TYPE extends DBSObject, CONTAINER_T
//////////////////////////////////////////////////
// Actions
protected
abstract
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
);
protected
abstract
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
);
protected
DBEPersistAction
[]
makeObjectModifyActions
(
ObjectChangeCommand
command
)
protected
void
addObjectModifyActions
(
List
<
DBEPersistAction
>
actionList
,
ObjectChangeCommand
command
)
{
// Base SQL syntax do not support object properties change
throw
new
IllegalStateException
(
"Object modification is not supported in "
+
getClass
().
getSimpleName
());
//$NON-NLS-1$
...
...
@@ -238,7 +238,9 @@ public abstract class SQLObjectEditor<OBJECT_TYPE extends DBSObject, CONTAINER_T
@Override
public
DBEPersistAction
[]
getPersistActions
()
{
return
makeObjectModifyActions
(
this
);
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>();
addObjectModifyActions
(
actions
,
this
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
@Override
...
...
@@ -268,7 +270,9 @@ public abstract class SQLObjectEditor<OBJECT_TYPE extends DBSObject, CONTAINER_T
@Override
public
DBEPersistAction
[]
getPersistActions
()
{
return
makeObjectCreateActions
(
this
);
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>();
addObjectCreateActions
(
actions
,
this
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/SQLStructEditor.java
浏览文件 @
70d85741
...
...
@@ -37,7 +37,7 @@ public abstract class SQLStructEditor<OBJECT_TYPE extends DBSEntity & DBPSaveabl
implements
DBEStructEditor
<
OBJECT_TYPE
>
{
protected
abstract
DBEPersistAction
[]
makeStructObjectCreateActions
(
StructCreateCommand
command
);
protected
abstract
void
addStructObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
StructCreateCommand
command
);
@Override
public
StructCreateCommand
makeCreateCommand
(
OBJECT_TYPE
object
)
...
...
@@ -115,7 +115,9 @@ public abstract class SQLStructEditor<OBJECT_TYPE extends DBSEntity & DBPSaveabl
@Override
public
DBEPersistAction
[]
getPersistActions
()
{
return
makeStructObjectCreateActions
(
this
);
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>();
addStructObjectCreateActions
(
actions
,
this
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLConstraintManager.java
浏览文件 @
70d85741
...
...
@@ -48,14 +48,14 @@ public abstract class SQLConstraintManager<OBJECT_TYPE extends JDBCTableConstrai
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
final
TABLE_TYPE
table
=
command
.
getObject
().
getTable
();
return
new
DBEPersistAction
[]
{
actions
.
add
(
new
SQLDatabasePersistAction
(
ModelMessages
.
model_jdbc_create_new_constraint
,
"ALTER TABLE "
+
table
.
getFullQualifiedName
()
+
" ADD "
+
getNestedDeclaration
(
table
,
command
))
};
//$NON-NLS-1$ //$NON-NLS-2$
"ALTER TABLE "
+
table
.
getFullQualifiedName
()
+
" ADD "
+
getNestedDeclaration
(
table
,
command
))
);
}
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLForeignKeyManager.java
浏览文件 @
70d85741
...
...
@@ -52,14 +52,14 @@ public abstract class SQLForeignKeyManager<OBJECT_TYPE extends JDBCTableConstrai
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
final
TABLE_TYPE
table
=
command
.
getObject
().
getTable
();
return
new
DBEPersistAction
[]
{
actions
.
add
(
new
SQLDatabasePersistAction
(
ModelMessages
.
model_jdbc_create_new_foreign_key
,
"ALTER TABLE "
+
table
.
getFullQualifiedName
()
+
" ADD "
+
getNestedDeclaration
(
table
,
command
))
//$NON-NLS-1$ //$NON-NLS-2$
}
;
)
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLIndexManager.java
浏览文件 @
70d85741
...
...
@@ -46,7 +46,7 @@ public abstract class SQLIndexManager<OBJECT_TYPE extends JDBCTableIndex<? exten
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
final
TABLE_TYPE
table
=
command
.
getObject
().
getTable
();
final
OBJECT_TYPE
index
=
command
.
getObject
();
...
...
@@ -79,9 +79,9 @@ public abstract class SQLIndexManager<OBJECT_TYPE extends JDBCTableIndex<? exten
}
decl
.
append
(
")"
);
//$NON-NLS-1$
return
new
DBEPersistAction
[]
{
actions
.
add
(
new
SQLDatabasePersistAction
(
ModelMessages
.
model_jdbc_create_new_index
,
decl
.
toString
())
}
;
)
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLTableColumnManager.java
浏览文件 @
70d85741
...
...
@@ -165,13 +165,13 @@ public abstract class SQLTableColumnManager<OBJECT_TYPE extends JDBCTableColumn<
}
@Override
protected
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
command
)
protected
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
command
)
{
final
TABLE_TYPE
table
=
command
.
getObject
().
getTable
();
return
new
DBEPersistAction
[]
{
actions
.
add
(
new
SQLDatabasePersistAction
(
ModelMessages
.
model_jdbc_create_new_table_column
,
"ALTER TABLE "
+
table
.
getFullQualifiedName
()
+
" ADD "
+
getNestedDeclaration
(
table
,
command
))
};
//$NON-NLS-1$ //$NON-NLS-2$
"ALTER TABLE "
+
table
.
getFullQualifiedName
()
+
" ADD "
+
getNestedDeclaration
(
table
,
command
))
);
}
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLTableManager.java
浏览文件 @
70d85741
...
...
@@ -39,7 +39,6 @@ import org.jkiss.dbeaver.model.struct.rdb.DBSTableIndex;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -59,21 +58,20 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T
}
@Override
protected
final
DBEPersistAction
[]
makeObjectCreateActions
(
ObjectCreateCommand
objectChangeCommand
)
protected
final
void
addObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
ObjectCreateCommand
objectChangeCommand
)
{
throw
new
IllegalStateException
(
"
make
ObjectCreateActions should never be called in struct editor"
);
throw
new
IllegalStateException
(
"
add
ObjectCreateActions should never be called in struct editor"
);
}
@Override
protected
DBEPersistAction
[]
makeStructObjectCreateActions
(
StructCreateCommand
command
)
protected
void
addStructObjectCreateActions
(
List
<
DBEPersistAction
>
actions
,
StructCreateCommand
command
)
{
final
OBJECT_TYPE
table
=
command
.
getObject
();
final
NestedObjectCommand
tableProps
=
command
.
getObjectCommands
().
get
(
table
);
if
(
tableProps
==
null
)
{
log
.
warn
(
"Object change command not found"
);
//$NON-NLS-1$
return
null
;
return
;
}
List
<
DBEPersistAction
>
actions
=
new
ArrayList
<>();
final
String
tableName
=
table
.
getFullQualifiedName
();
final
String
lineSeparator
=
GeneralUtils
.
getDefaultLineSeparator
();
...
...
@@ -106,8 +104,6 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T
actions
.
add
(
0
,
new
SQLDatabasePersistAction
(
ModelMessages
.
model_jdbc_create_new_table
,
createQuery
.
toString
())
);
addObjectExtraActions
(
actions
,
command
);
return
actions
.
toArray
(
new
DBEPersistAction
[
actions
.
size
()]);
}
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录