Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
ff2f3f5c
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
ff2f3f5c
编写于
8月 15, 2017
作者:
K
Karl Grießer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Exasol Foreign Key Manager Implementation
Former-commit-id:
090e4cc3
上级
bf88824e
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
82 addition
and
20 deletion
+82
-20
plugins/org.jkiss.dbeaver.ext.exasol/META-INF/MANIFEST.MF
plugins/org.jkiss.dbeaver.ext.exasol/META-INF/MANIFEST.MF
+2
-1
plugins/org.jkiss.dbeaver.ext.exasol/plugin.properties
plugins/org.jkiss.dbeaver.ext.exasol/plugin.properties
+4
-0
plugins/org.jkiss.dbeaver.ext.exasol/plugin.xml
plugins/org.jkiss.dbeaver.ext.exasol/plugin.xml
+4
-0
plugins/org.jkiss.dbeaver.ext.exasol/plugin_de.properties
plugins/org.jkiss.dbeaver.ext.exasol/plugin_de.properties
+4
-1
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ExasolMessages.java
...asol/src/org/jkiss/dbeaver/ext/exasol/ExasolMessages.java
+1
-0
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ExasolResources.properties
...c/org/jkiss/dbeaver/ext/exasol/ExasolResources.properties
+1
-0
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ExasolResources_de.properties
...rg/jkiss/dbeaver/ext/exasol/ExasolResources_de.properties
+3
-0
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/model/ExasolTableForeignKey.java
...jkiss/dbeaver/ext/exasol/model/ExasolTableForeignKey.java
+27
-8
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/tools/ExasolUtils.java
...l/src/org/jkiss/dbeaver/ext/exasol/tools/ExasolUtils.java
+16
-5
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ui/ExasolConnectionDialog.java
...g/jkiss/dbeaver/ext/exasol/ui/ExasolConnectionDialog.java
+2
-3
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ui/ExasolCreateSchemaDialog.java
...jkiss/dbeaver/ext/exasol/ui/ExasolCreateSchemaDialog.java
+18
-2
未找到文件。
plugins/org.jkiss.dbeaver.ext.exasol/META-INF/MANIFEST.MF
浏览文件 @
ff2f3f5c
...
...
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui,
org.jkiss.dbeaver.core,
org.eclipse.ui.workbench.texteditor,
org.eclipse.ui.editors,
org.jkiss.dbeaver.ext.ui.locks
org.jkiss.dbeaver.ext.ui.locks,
org.eclipse.core.resources
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Vendor: JKISS
...
...
plugins/org.jkiss.dbeaver.ext.exasol/plugin.properties
浏览文件 @
ff2f3f5c
...
...
@@ -239,3 +239,7 @@ tree.virtualschema.node.name = Virtual Schema
tree.virtualschemaparameters.node.name
=
Virtual Schema Parameters
tree.virtualschemas.node.name
=
Virtual Schemas
tree.locks.node.name
=
Lock Manager
meta.org.jkiss.dbeaver.model.struct.rdb.DBSTableConstraintColumn.attribute.name
=
Column Name
meta.org.jkiss.dbeaver.model.struct.rdb.DBSTableConstraintColumn.ordinalPosition.name
=
Ordinal Position
plugins/org.jkiss.dbeaver.ext.exasol/plugin.xml
浏览文件 @
ff2f3f5c
...
...
@@ -447,6 +447,10 @@
class=
"org.jkiss.dbeaver.ext.exasol.manager.ExasolConnectionManager"
objectType=
"org.jkiss.dbeaver.ext.exasol.model.ExasolConnection"
>
</manager>
<manager
class=
"org.jkiss.dbeaver.ext.exasol.manager.ExasolForeignKeyManager"
objectType=
"org.jkiss.dbeaver.ext.exasol.model.ExasolTableForeignKey"
>
</manager>
</extension>
<extension
point=
"org.eclipse.ui.editors"
>
<editor
...
...
plugins/org.jkiss.dbeaver.ext.exasol/plugin_de.properties
浏览文件 @
ff2f3f5c
...
...
@@ -207,4 +207,7 @@ tree.viewsauths.node.name = View Berechtigungen
tree.virtualschema.node.name
=
Virtuelles Schema
tree.virtualschemaparameters.node.name
=
Virtuelles Schema - Parameter
tree.virtualschemas.node.name
=
Virtuelle Schemata
tree.locks.node.name
=
Lock Manager
\ No newline at end of file
tree.locks.node.name
=
Lock Manager
meta.org.jkiss.dbeaver.model.struct.rdb.DBSTableConstraintColumn.attribute.name
=
Spaltenname
meta.org.jkiss.dbeaver.model.struct.rdb.DBSTableConstraintColumn.ordinalPosition.name
=
Spaltennr.
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ExasolMessages.java
浏览文件 @
ff2f3f5c
...
...
@@ -62,6 +62,7 @@ public class ExasolMessages extends NLS {
public
static
String
dialog_table_tools_row_sep
;
public
static
String
dialog_table_tools_encoding
;
public
static
String
dialog_table_tools_import_title
;
public
static
String
dialog_struct_edit_fk_label_fk_name
;
}
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ExasolResources.properties
浏览文件 @
ff2f3f5c
...
...
@@ -28,6 +28,7 @@ dialog_table_tools_file_template=File Template
dialog_table_tools_export_title
=
Export to CSV File
dialog_table_tools_import_title
=
Import from CSV File
dialog_struct_edit_fk_label_fk_name
=
Foreign Key Name
editors_exasol_session_editor_title_kill_session
=
Kill Session
...
...
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ExasolResources_de.properties
浏览文件 @
ff2f3f5c
...
...
@@ -46,3 +46,6 @@ editors_exasol_session_editor_confirm_action = {0} "{1}". Sind Sie sicher?
editors_exasol_session_editor_title_kill_session
=
Verbindung terminieren
editors_exasol_session_editor_title_kill_session_statement
=
Befehl terminieren
dialog_struct_edit_fk_label_fk_name
=
Fremschl
\u
00FCsselname
\ No newline at end of file
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/model/ExasolTableForeignKey.java
浏览文件 @
ff2f3f5c
...
...
@@ -23,6 +23,7 @@ import org.jkiss.dbeaver.DBException;
import
org.jkiss.dbeaver.ext.exasol.tools.ExasolUtils
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.DBPNamedObject2
;
import
org.jkiss.dbeaver.model.DBPScriptObject
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
...
...
@@ -41,13 +42,14 @@ import java.util.List;
/**
* @author Karl
*/
public
class
ExasolTableForeignKey
extends
JDBCTableConstraint
<
ExasolTable
>
implements
DBSTableForeignKey
,
DBPScriptObject
{
public
class
ExasolTableForeignKey
extends
JDBCTableConstraint
<
ExasolTable
>
implements
DBSTableForeignKey
,
DBPScriptObject
,
DBPNamedObject2
{
private
ExasolTable
refTable
;
private
String
constName
;
private
Boolean
enabled
;
private
List
<
ExasolTableKeyColumn
>
columns
;
private
ExasolTableUniqueKey
referencedKey
;
...
...
@@ -60,18 +62,22 @@ public class ExasolTableForeignKey extends JDBCTableConstraint<ExasolTable> impl
String
refSchemaName
=
JDBCUtils
.
safeGetString
(
dbResult
,
"REFERENCED_SCHEMA"
);
String
refTableName
=
JDBCUtils
.
safeGetString
(
dbResult
,
"REFERENCED_TABLE"
);
String
constName
=
JDBCUtils
.
safeGetString
(
dbResult
,
"REF_PK_NAME"
);
this
.
constName
=
JDBCUtils
.
safeGetString
(
dbResult
,
"CONSTRAINT_NAME"
);
String
refConstName
=
JDBCUtils
.
safeGetString
(
dbResult
,
"REF_PK_NAME"
);
refTable
=
ExasolUtils
.
findTableBySchemaNameAndName
(
monitor
,
exasolTable
.
getDataSource
(),
refSchemaName
,
refTableName
);
enabled
=
JDBCUtils
.
safeGetBoolean
(
dbResult
,
"CONSTRAINT_ENABLED"
);
referencedKey
=
refTable
.
getConstraint
(
monitor
,
c
onstName
);
referencedKey
=
refTable
.
getConstraint
(
monitor
,
refC
onstName
);
}
public
ExasolTableForeignKey
(
ExasolTable
exasolTable
,
ExasolTableUniqueKey
referencedKey
,
Boolean
enabled
)
{
super
(
exasolTable
,
n
ull
,
null
,
DBSEntityConstraintType
.
FOREIGN_KEY
,
true
);
public
ExasolTableForeignKey
(
ExasolTable
exasolTable
,
ExasolTableUniqueKey
referencedKey
,
Boolean
enabled
,
String
name
)
{
super
(
exasolTable
,
n
ame
,
""
,
DBSEntityConstraintType
.
FOREIGN_KEY
,
true
);
this
.
referencedKey
=
referencedKey
;
this
.
enabled
=
enabled
;
this
.
constName
=
name
;
this
.
refTable
=
referencedKey
.
getTable
();
}
...
...
@@ -160,6 +166,19 @@ public class ExasolTableForeignKey extends JDBCTableConstraint<ExasolTable> impl
{
return
ExasolUtils
.
getFKDdl
(
this
,
monitor
);
}
@Override
@Property
(
viewable
=
true
)
public
String
getName
()
{
return
this
.
constName
;
}
@Override
public
void
setName
(
String
name
)
{
this
.
constName
=
name
;
}
}
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/tools/ExasolUtils.java
浏览文件 @
ff2f3f5c
...
...
@@ -21,6 +21,7 @@ import org.jkiss.dbeaver.DBException;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ext.exasol.model.*
;
import
org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
...
...
@@ -131,7 +132,7 @@ public class ExasolUtils {
//get only first as there is only 1 primary key
ExasolTableUniqueKey
pk
=
null
;
pk
=
pks
.
iterator
().
next
();
ddlOutput
.
append
(
getPKDdl
(
pk
,
monitor
)
);
ddlOutput
.
append
(
"\n"
+
getPKDdl
(
pk
,
monitor
)
+
";\n"
);
}
//foreign key
...
...
@@ -140,7 +141,7 @@ public class ExasolUtils {
//look keys
for
(
ExasolTableForeignKey
fk
:
fks
)
{
ddlOutput
.
append
(
getFKDdl
(
fk
,
monitor
)
);
ddlOutput
.
append
(
"\n"
+
getFKDdl
(
fk
,
monitor
)
+
";\n"
);
}
}
...
...
@@ -158,15 +159,25 @@ public class ExasolUtils {
{
ExasolTable
exasolTable
=
fk
.
getTable
();
ArrayList
<
String
>
columns
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
refColumns
=
new
ArrayList
<
String
>();
for
(
DBSEntityAttributeRef
c
:
fk
.
getAttributeReferences
(
monitor
))
{
columns
.
add
(
"\""
+
c
.
getAttribute
().
getName
()
+
"\""
);
columns
.
add
(
DBUtils
.
getQuotedIdentifier
(
c
.
getAttribute
()));
}
for
(
DBSEntityAttributeRef
c
:
fk
.
getReferencedConstraint
().
getAttributeReferences
(
monitor
))
{
refColumns
.
add
(
DBUtils
.
getQuotedIdentifier
(
c
.
getAttribute
()));
}
String
fk_enabled
=
" DISABLE "
;
if
(
fk
.
getEnabled
())
fk_enabled
=
" ENABLE "
;
return
"\nALTER TABLE \""
+
exasolTable
.
getSchema
().
getName
()
+
"\".\""
+
exasolTable
.
getName
()
+
"\" ADD CONSTRAINT "
+
fk
.
getName
()
+
" FOREIGN KEY ("
+
CommonUtils
.
joinStrings
(
","
,
columns
)
+
") REFERENCES \""
+
fk
.
getReferencedTable
().
getSchema
().
getName
()
+
"\".\""
+
fk
.
getReferencedTable
().
getName
()
+
"\" "
+
fk_enabled
+
" ;\n"
;
return
"ALTER TABLE "
+
DBUtils
.
getObjectFullName
(
exasolTable
,
DBPEvaluationContext
.
DDL
)
+
" ADD CONSTRAINT "
+
DBUtils
.
getQuotedIdentifier
(
fk
)
+
" FOREIGN KEY ("
+
CommonUtils
.
joinStrings
(
","
,
columns
)
+
") REFERENCES "
+
DBUtils
.
getObjectFullName
(
fk
.
getAssociatedEntity
(),
DBPEvaluationContext
.
DDL
)
+
" ("
+
CommonUtils
.
joinStrings
(
","
,
refColumns
)
+
")"
+
fk_enabled
;
}
...
...
@@ -177,7 +188,7 @@ public class ExasolUtils {
for
(
DBSEntityAttributeRef
c
:
pk
.
getAttributeReferences
(
monitor
))
{
columns
.
add
(
"\""
+
c
.
getAttribute
().
getName
()
+
"\""
);
}
return
"
\nALTER TABLE \""
+
exasolTable
.
getSchema
().
getName
()
+
"\".\""
+
exasolTable
.
getName
()
+
"\" ADD CONSTRAINT "
+
pk
.
getName
()
+
" PRIMARY KEY ("
+
CommonUtils
.
joinStrings
(
","
,
columns
)
+
") "
+
(
pk
.
getEnabled
()
?
" ENABLE "
:
" DISABLE "
)
+
" ;\n"
;
return
"
ALTER TABLE "
+
DBUtils
.
getObjectFullName
(
exasolTable
,
DBPEvaluationContext
.
DDL
)
+
" ADD CONSTRAINT "
+
DBUtils
.
getQuotedIdentifier
(
pk
)
+
" PRIMARY KEY ("
+
CommonUtils
.
joinStrings
(
","
,
columns
)
+
") "
+
(
pk
.
getEnabled
()
?
" ENABLE "
:
" DISABLE "
)
;
}
public
static
String
getConnectionDdl
(
ExasolConnection
con
,
DBRProgressMonitor
monitor
)
throws
DBException
...
...
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ui/ExasolConnectionDialog.java
浏览文件 @
ff2f3f5c
...
...
@@ -59,12 +59,10 @@ public class ExasolConnectionDialog extends BaseDialog {
final
Composite
group
=
new
Composite
(
composite
,
SWT
.
NONE
);
group
.
setLayout
(
new
GridLayout
(
2
,
false
));
final
Text
nameText
=
UIUtils
.
createLabelText
(
group
,
"
Schema
Name"
,
""
);
final
Text
nameText
=
UIUtils
.
createLabelText
(
group
,
"
Connection
Name"
,
""
);
final
Text
urlText
=
UIUtils
.
createLabelText
(
group
,
"Connection URL"
,
""
);
final
Group
configGroup
=
UIUtils
.
createControlGroup
(
group
,
"Credentials"
,
1
,
GridData
.
FILL_HORIZONTAL
,
0
);
Button
saveCred
=
UIUtils
.
createCheckbox
(
configGroup
,
"Provide Credentials"
,
false
);
...
...
@@ -80,6 +78,7 @@ public class ExasolConnectionDialog extends BaseDialog {
public
void
modifyText
(
ModifyEvent
e
)
{
name
=
nameText
.
getText
();
user
=
userText
.
getText
();
url
=
urlText
.
getText
();
password
=
passwordText
.
getText
();
comment
=
commentText
.
getText
();
getButton
(
IDialogConstants
.
OK_ID
).
setEnabled
(!
name
.
isEmpty
());
...
...
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/ui/ExasolCreateSchemaDialog.java
浏览文件 @
ff2f3f5c
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2016-2017 Karl Griesser (fullref@gmail.com)
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.exasol.ui
;
import
java.util.ArrayList
;
...
...
@@ -40,7 +58,6 @@ public class ExasolCreateSchemaDialog extends BaseDialog {
this
.
datasource
=
datasource
;
}
@SuppressWarnings
(
"unchecked"
)
@Override
protected
Composite
createDialogArea
(
Composite
parent
)
{
...
...
@@ -71,7 +88,6 @@ public class ExasolCreateSchemaDialog extends BaseDialog {
@Override
protected
IStatus
run
(
DBRProgressMonitor
monitor
)
{
try
{
final
List
<
String
>
granteeNames
=
new
ArrayList
<>();
grantees
=
new
ArrayList
<>(
datasource
.
getAllGrantees
(
monitor
));
DBeaverUI
.
syncExec
(
new
Runnable
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录