Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
d87bc921
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,发现更多精彩内容 >>
提交
d87bc921
编写于
3月 21, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3186 Inherited tables DDL
上级
f7ad7c98
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
63 addition
and
14 deletion
+63
-14
plugins/org.jkiss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
...ss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
+2
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreAttribute.java
.../jkiss/dbeaver/ext/postgresql/model/PostgreAttribute.java
+14
-5
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
...org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
+6
-5
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPInheritedObject.java
...model/src/org/jkiss/dbeaver/model/DBPInheritedObject.java
+29
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBUtils.java
...ss.dbeaver.model/src/org/jkiss/dbeaver/model/DBUtils.java
+4
-0
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
+8
-4
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
浏览文件 @
d87bc921
...
...
@@ -59,6 +59,8 @@ meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute.scale.name=Scale
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute.scale.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute.identity.name
=
Identity
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute.identity.description
=
Attribute identity (always or by default)
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute.local.name
=
Local
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAttribute.local.description
=
This column is defined locally in the relation. Note that a column can be locally defined and inherited simultaneously.
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreRole.bypassRls.name
=
Bypass Rls
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreRole.bypassRls.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreRole.canLogin.name
=
Can Login
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreAttribute.java
浏览文件 @
d87bc921
...
...
@@ -22,10 +22,7 @@ import org.jkiss.dbeaver.DBException;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreConstants
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreUtils
;
import
org.jkiss.dbeaver.model.DBPDataKind
;
import
org.jkiss.dbeaver.model.DBPHiddenObject
;
import
org.jkiss.dbeaver.model.DBPNamedObject2
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.*
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.impl.DBPositiveNumberTransformer
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
...
...
@@ -44,7 +41,7 @@ import java.util.TreeSet;
/**
* PostgreAttribute
*/
public
abstract
class
PostgreAttribute
<
OWNER
extends
DBSEntity
&
PostgreObject
>
extends
JDBCTableColumn
<
OWNER
>
implements
DBSTypedObjectEx
,
DBPNamedObject2
,
DBPHiddenObject
public
abstract
class
PostgreAttribute
<
OWNER
extends
DBSEntity
&
PostgreObject
>
extends
JDBCTableColumn
<
OWNER
>
implements
DBSTypedObjectEx
,
DBPNamedObject2
,
DBPHiddenObject
,
DBPInheritedObject
{
private
static
final
Log
log
=
Log
.
getLog
(
PostgreAttribute
.
class
);
...
...
@@ -57,6 +54,7 @@ public abstract class PostgreAttribute<OWNER extends DBSEntity & PostgreObject>
private
String
description
;
@Nullable
private
PostgreAttributeIdentity
identity
;
private
boolean
isLocal
;
protected
PostgreAttribute
(
OWNER
table
)
...
...
@@ -124,6 +122,7 @@ public abstract class PostgreAttribute<OWNER extends DBSEntity & PostgreObject>
this
.
description
=
JDBCUtils
.
safeGetString
(
dbResult
,
"description"
);
this
.
arrayDim
=
JDBCUtils
.
safeGetInt
(
dbResult
,
"attndims"
);
this
.
inheritorsCount
=
JDBCUtils
.
safeGetInt
(
dbResult
,
"attinhcount"
);
this
.
isLocal
=
JDBCUtils
.
safeGetBoolean
(
dbResult
,
"attislocal"
);
if
(
getDataSource
().
isServerVersionAtLeast
(
10
,
0
))
{
String
identityStr
=
JDBCUtils
.
safeGetString
(
dbResult
,
"attidentity"
);
...
...
@@ -197,6 +196,11 @@ public abstract class PostgreAttribute<OWNER extends DBSEntity & PostgreObject>
this
.
identity
=
identity
;
}
@Property
(
viewable
=
false
,
order
=
25
)
public
boolean
isLocal
()
{
return
isLocal
;
}
@Override
@Property
(
viewable
=
true
,
editable
=
true
,
updatable
=
true
,
order
=
50
)
public
boolean
isRequired
()
...
...
@@ -238,6 +242,11 @@ public abstract class PostgreAttribute<OWNER extends DBSEntity & PostgreObject>
return
isPersisted
()
&&
getOrdinalPosition
()
<
0
;
}
@Override
public
boolean
isInherited
()
{
return
!
isLocal
;
}
public
String
getFullTypeName
()
{
String
fqtn
=
dataType
.
getTypeName
();
if
(
dataType
.
getDataKind
()
!=
DBPDataKind
.
CONTENT
)
{
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
浏览文件 @
d87bc921
...
...
@@ -463,12 +463,13 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
return
prepareChildrenStatement
(
session
,
owner
);
}
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
"SELECT c.relname,a.*,pg_catalog.pg_get_expr(ad.adbin, ad.adrelid, true) as def_value,dsc.description"
+
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
"SELECT c.relname,a.*,pg_catalog.pg_get_expr(ad.adbin, ad.adrelid, true) as def_value,dsc.description"
+
"\nFROM pg_catalog.pg_attribute a"
+
"\nINNER JOIN pg_catalog.pg_class c ON (a.attrelid=c.oid)"
+
"\nLEFT OUTER JOIN pg_catalog.pg_attrdef ad ON (a.attrelid=ad.adrelid AND a.attnum = ad.adnum)"
+
"\nLEFT OUTER JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid)"
+
"\nWHERE NOT a.attisdropped AND c.oid=? ORDER BY a.attnum"
);
"\nINNER JOIN pg_catalog.pg_class c ON (a.attrelid=c.oid)"
+
"\nLEFT OUTER JOIN pg_catalog.pg_attrdef ad ON (a.attrelid=ad.adrelid AND a.attnum = ad.adnum)"
+
"\nLEFT OUTER JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid)"
+
"\nWHERE NOT a.attisdropped AND c.oid=? ORDER BY a.attnum"
);
dbStat
.
setLong
(
1
,
forTable
.
getObjectId
());
return
dbStat
;
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPInheritedObject.java
0 → 100644
浏览文件 @
d87bc921
/*
* DBeaver - Universal Database Manager
* 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.model
;
/**
* Objects inherited from parent object.
* Can be implemented by attributes/methods.
*/
public
interface
DBPInheritedObject
{
boolean
isInherited
();
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBUtils.java
浏览文件 @
d87bc921
...
...
@@ -1379,6 +1379,10 @@ public final class DBUtils {
return
object
instanceof
DBPHiddenObject
&&
((
DBPHiddenObject
)
object
).
isHidden
();
}
public
static
boolean
isInheritedObject
(
Object
object
)
{
return
object
instanceof
DBPInheritedObject
&&
((
DBPInheritedObject
)
object
).
isInherited
();
}
public
static
DBDPseudoAttribute
getRowIdAttribute
(
DBSEntity
entity
)
{
if
(
entity
instanceof
DBDPseudoAttributeContainer
)
{
try
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLTableManager.java
浏览文件 @
d87bc921
...
...
@@ -170,7 +170,8 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T
if
(
tcm
!=
null
)
{
// Aggregate nested column, constraint and index commands
for
(
DBSEntityAttribute
column
:
CommonUtils
.
safeCollection
(
table
.
getAttributes
(
monitor
)))
{
if
(
DBUtils
.
isHiddenObject
(
column
))
{
if
(
DBUtils
.
isHiddenObject
(
column
)
||
DBUtils
.
isInheritedObject
(
column
))
{
// Do not include hidden (pseudo?) and inherited columns in DDL
continue
;
}
command
.
aggregateCommand
(
tcm
.
makeCreateCommand
(
column
));
...
...
@@ -179,7 +180,7 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T
if
(
pkm
!=
null
)
{
try
{
for
(
DBSTableConstraint
constraint
:
CommonUtils
.
safeCollection
(
table
.
getConstraints
(
monitor
)))
{
if
(
DBUtils
.
isHiddenObject
(
constraint
))
{
if
(
DBUtils
.
isHiddenObject
(
constraint
)
||
DBUtils
.
isInheritedObject
(
constraint
)
)
{
continue
;
}
command
.
aggregateCommand
(
pkm
.
makeCreateCommand
(
constraint
));
...
...
@@ -192,7 +193,10 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T
if
(
fkm
!=
null
)
{
try
{
for
(
DBSEntityAssociation
foreignKey
:
CommonUtils
.
safeCollection
(
table
.
getAssociations
(
monitor
)))
{
if
(!(
foreignKey
instanceof
DBSTableForeignKey
)
||
DBUtils
.
isHiddenObject
(
foreignKey
))
{
if
(!(
foreignKey
instanceof
DBSTableForeignKey
)
||
DBUtils
.
isHiddenObject
(
foreignKey
)
||
DBUtils
.
isInheritedObject
(
foreignKey
))
{
continue
;
}
command
.
aggregateCommand
(
fkm
.
makeCreateCommand
((
DBSTableForeignKey
)
foreignKey
));
...
...
@@ -205,7 +209,7 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T
if
(
im
!=
null
)
{
try
{
for
(
DBSTableIndex
index
:
CommonUtils
.
safeCollection
(
table
.
getIndexes
(
monitor
)))
{
if
(
DBUtils
.
isHiddenObject
(
index
))
{
if
(
DBUtils
.
isHiddenObject
(
index
)
||
DBUtils
.
isInheritedObject
(
index
)
)
{
continue
;
}
command
.
aggregateCommand
(
im
.
makeCreateCommand
(
index
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录