Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
f16465f7
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,发现更多精彩内容 >>
提交
f16465f7
编写于
12月 31, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RSV: pseudo attributes (get ROWID identifiers with disabled metadata read)
Former-commit-id:
6601926d
上级
6272b909
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
71 addition
and
55 deletion
+71
-55
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/data/DBDAttributeBinding.java
...src/org/jkiss/dbeaver/model/data/DBDAttributeBinding.java
+4
-0
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetUtils.java
...g/jkiss/dbeaver/ui/controls/resultset/ResultSetUtils.java
+67
-55
未找到文件。
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/data/DBDAttributeBinding.java
浏览文件 @
f16465f7
...
...
@@ -284,6 +284,10 @@ public abstract class DBDAttributeBinding implements DBSObject, DBSAttributeBase
}
public
void
lateBinding
(
@NotNull
DBCSession
session
,
List
<
Object
[]>
rows
)
throws
DBException
{
}
public
void
loadTransformers
(
@NotNull
DBCSession
session
,
List
<
Object
[]>
rows
)
throws
DBException
{
DBSAttributeBase
attribute
=
getAttribute
();
final
DBDAttributeTransformer
[]
transformers
=
DBVUtils
.
findAttributeTransformers
(
this
,
null
);
if
(
transformers
!=
null
)
{
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetUtils.java
浏览文件 @
f16465f7
...
...
@@ -73,7 +73,8 @@ public class ResultSetUtils
final
DBRProgressMonitor
monitor
=
session
.
getProgressMonitor
();
final
DBPDataSource
dataSource
=
session
.
getDataSource
();
boolean
readMetaData
=
dataSource
.
getContainer
().
getPreferenceStore
().
getBoolean
(
ResultSetPreferences
.
RESULT_SET_READ_METADATA
);
if
(!
readMetaData
)
{
if
(!
readMetaData
&&
sourceEntity
==
null
)
{
// Do not read metadata if source entity is not known
return
;
}
boolean
readReferences
=
dataSource
.
getContainer
().
getPreferenceStore
().
getBoolean
(
ResultSetPreferences
.
RESULT_SET_READ_REFERENCES
);
...
...
@@ -196,38 +197,47 @@ public class ResultSetUtils
}
monitor
.
worked
(
1
);
// Init row identifiers
monitor
.
subTask
(
"Detect unique identifiers"
);
for
(
DBDAttributeBindingMeta
binding
:
bindings
)
{
//monitor.subTask("Find attribute '" + binding.getName() + "' identifier");
DBSEntityAttribute
attr
=
binding
.
getEntityAttribute
();
if
(
attr
==
null
)
{
continue
;
}
DBSEntity
attrEntity
=
attr
.
getParentObject
();
if
(
attrEntity
!=
null
)
{
DBDRowIdentifier
rowIdentifier
=
locatorMap
.
get
(
attrEntity
);
if
(
rowIdentifier
==
null
)
{
DBSEntityReferrer
entityIdentifier
=
getBestIdentifier
(
monitor
,
attrEntity
,
bindings
);
if
(
entityIdentifier
!=
null
)
{
rowIdentifier
=
new
DBDRowIdentifier
(
attrEntity
,
entityIdentifier
);
locatorMap
.
put
(
attrEntity
,
rowIdentifier
);
{
// Init row identifiers
monitor
.
subTask
(
"Detect unique identifiers"
);
for
(
DBDAttributeBindingMeta
binding
:
bindings
)
{
//monitor.subTask("Find attribute '" + binding.getName() + "' identifier");
DBSEntityAttribute
attr
=
binding
.
getEntityAttribute
();
if
(
attr
==
null
)
{
continue
;
}
DBSEntity
attrEntity
=
attr
.
getParentObject
();
if
(
attrEntity
!=
null
)
{
DBDRowIdentifier
rowIdentifier
=
locatorMap
.
get
(
attrEntity
);
if
(
rowIdentifier
==
null
)
{
DBSEntityReferrer
entityIdentifier
=
getBestIdentifier
(
monitor
,
attrEntity
,
bindings
,
readMetaData
);
if
(
entityIdentifier
!=
null
)
{
rowIdentifier
=
new
DBDRowIdentifier
(
attrEntity
,
entityIdentifier
);
locatorMap
.
put
(
attrEntity
,
rowIdentifier
);
}
}
binding
.
setRowIdentifier
(
rowIdentifier
);
}
binding
.
setRowIdentifier
(
rowIdentifier
);
}
monitor
.
worked
(
1
);
}
monitor
.
worked
(
1
);
if
(
readReferences
&&
rows
!=
null
)
{
if
(
read
MetaData
&&
read
References
&&
rows
!=
null
)
{
monitor
.
subTask
(
"Read results metadata"
);
// Read nested bindings
for
(
DBDAttributeBinding
binding
:
bindings
)
{
binding
.
lateBinding
(
session
,
rows
);
}
}
monitor
.
subTask
(
"Load transformers"
);
// Load transformers
for
(
DBDAttributeBinding
binding
:
bindings
)
{
binding
.
loadTransformers
(
session
,
rows
);
}
monitor
.
subTask
(
"Complete metadata load"
);
// Reload attributes in row identifiers
for
(
DBDRowIdentifier
rowIdentifier
:
locatorMap
.
values
())
{
...
...
@@ -276,53 +286,55 @@ public class ResultSetUtils
}
}
private
static
DBSEntityReferrer
getBestIdentifier
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBSEntity
table
,
DBDAttributeBindingMeta
[]
bindings
)
private
static
DBSEntityReferrer
getBestIdentifier
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
DBSEntity
table
,
DBDAttributeBindingMeta
[]
bindings
,
boolean
readMetaData
)
throws
DBException
{
List
<
DBSEntityReferrer
>
identifiers
=
new
ArrayList
<>(
2
);
if
(
table
instanceof
DBSTable
&&
((
DBSTable
)
table
).
isView
())
{
// Skip physical identifiers for views. There are nothing anyway
if
(
readMetaData
)
{
if
(
table
instanceof
DBSTable
&&
((
DBSTable
)
table
).
isView
())
{
// Skip physical identifiers for views. There are nothing anyway
}
else
{
// Check indexes first.
if
(
table
instanceof
DBSTable
)
{
try
{
Collection
<?
extends
DBSTableIndex
>
indexes
=
((
DBSTable
)
table
).
getIndexes
(
monitor
);
if
(!
CommonUtils
.
isEmpty
(
indexes
))
{
// First search for primary index
for
(
DBSTableIndex
index
:
indexes
)
{
if
(
index
.
isPrimary
()
&&
DBUtils
.
isIdentifierIndex
(
monitor
,
index
))
{
identifiers
.
add
(
index
);
break
;
}
else
{
// Check indexes first.
if
(
table
instanceof
DBSTable
)
{
try
{
Collection
<?
extends
DBSTableIndex
>
indexes
=
((
DBSTable
)
table
).
getIndexes
(
monitor
);
if
(!
CommonUtils
.
isEmpty
(
indexes
))
{
// First search for primary index
for
(
DBSTableIndex
index
:
indexes
)
{
if
(
index
.
isPrimary
()
&&
DBUtils
.
isIdentifierIndex
(
monitor
,
index
))
{
identifiers
.
add
(
index
);
break
;
}
}
}
// Then search for unique index
for
(
DBSTableIndex
index
:
indexes
)
{
if
(
DBUtils
.
isIdentifierIndex
(
monitor
,
index
))
{
identifiers
.
add
(
index
)
;
break
;
// Then search for unique index
for
(
DBSTableIndex
index
:
indexes
)
{
if
(
DBUtils
.
isIdentifierIndex
(
monitor
,
index
)
)
{
identifiers
.
add
(
index
);
break
;
}
}
}
}
catch
(
Exception
e
)
{
// Indexes are not supported or not available
// Just skip them
log
.
debug
(
e
);
}
}
catch
(
Exception
e
)
{
// Indexes are not supported or not available
// Just skip them
log
.
debug
(
e
);
}
}
{
// Check constraints
Collection
<?
extends
DBSEntityConstraint
>
constraints
=
table
.
getConstraints
(
monitor
);
if
(
constraints
!=
null
)
{
for
(
DBSEntityConstraint
constraint
:
constraints
)
{
if
(
DBUtils
.
isIdentifierConstraint
(
monitor
,
constraint
))
{
identifiers
.
add
((
DBSEntityReferrer
)
constraint
);
{
// Check constraints
Collection
<?
extends
DBSEntityConstraint
>
constraints
=
table
.
getConstraints
(
monitor
);
if
(
constraints
!=
null
)
{
for
(
DBSEntityConstraint
constraint
:
constraints
)
{
if
(
DBUtils
.
isIdentifierConstraint
(
monitor
,
constraint
)
)
{
identifiers
.
add
((
DBSEntityReferrer
)
constraint
);
}
}
}
}
}
}
}
if
(
CommonUtils
.
isEmpty
(
identifiers
))
{
// Check for pseudo attrs (ROWID)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录