Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
c06ebaa0
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,发现更多精彩内容 >>
提交
c06ebaa0
编写于
9月 20, 2016
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cache model improvement (merge lists)
上级
dd7b8af9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
15 deletion
+56
-15
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetUtils.java
...g/jkiss/dbeaver/ui/controls/resultset/ResultSetUtils.java
+19
-7
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/AbstractObjectCache.java
...src/org/jkiss/dbeaver/model/impl/AbstractObjectCache.java
+36
-7
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/cache/JDBCObjectCache.java
.../jkiss/dbeaver/model/impl/jdbc/cache/JDBCObjectCache.java
+1
-1
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetUtils.java
浏览文件 @
c06ebaa0
...
...
@@ -61,6 +61,8 @@ public class ResultSetUtils
List
<
Object
[]>
rows
)
{
DBRProgressMonitor
monitor
=
session
.
getProgressMonitor
();
Map
<
DBCEntityMetaData
,
DBSEntity
>
entityBindingMap
=
new
IdentityHashMap
<>();
monitor
.
beginTask
(
"Discover resultset metadata"
,
3
);
try
{
SQLQuery
sqlQuery
=
null
;
...
...
@@ -84,6 +86,9 @@ public class ResultSetUtils
}
if
(
entityMeta
!=
null
)
{
entity
=
getEntityFromMetaData
(
session
,
entityMeta
);
if
(
entity
!=
null
)
{
entityBindingMap
.
put
(
entityMeta
,
entity
);
}
}
}
}
...
...
@@ -98,13 +103,20 @@ public class ResultSetUtils
// To be editable we need this resultset contain set of columns from the same table
// which construct any unique key
DBSEntity
attrEntity
=
null
;
if
(
attrMeta
.
getEntityMetaData
()
!=
null
)
{
if
(
entity
!=
null
&&
entity
instanceof
DBSTable
&&
((
DBSTable
)
entity
).
isView
())
{
// If this is a view then don't try to detect entity for each attribute
// MySQL returns rouce table name instead of view name. That's crazy.
attrEntity
=
entity
;
}
else
{
attrEntity
=
getEntityFromMetaData
(
session
,
attrMeta
.
getEntityMetaData
());
final
DBCEntityMetaData
attrEntityMeta
=
attrMeta
.
getEntityMetaData
();
if
(
attrEntityMeta
!=
null
)
{
attrEntity
=
entityBindingMap
.
get
(
attrEntityMeta
);
if
(
attrEntity
==
null
)
{
if
(
entity
!=
null
&&
entity
instanceof
DBSTable
&&
((
DBSTable
)
entity
).
isView
())
{
// If this is a view then don't try to detect entity for each attribute
// MySQL returns rouce table name instead of view name. That's crazy.
attrEntity
=
entity
;
}
else
{
attrEntity
=
getEntityFromMetaData
(
session
,
attrEntityMeta
);
}
}
if
(
attrEntity
!=
null
)
{
entityBindingMap
.
put
(
attrEntityMeta
,
attrEntity
);
}
}
if
(
attrEntity
==
null
)
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/AbstractObjectCache.java
浏览文件 @
c06ebaa0
...
...
@@ -95,13 +95,14 @@ public abstract class AbstractObjectCache<OWNER extends DBSObject, OBJECT extend
{
synchronized
(
this
)
{
if
(
this
.
objectList
==
null
)
{
detectCaseSensitivity
(
object
);
this
.
objectList
.
add
(
object
);
if
(
this
.
objectMap
!=
null
)
{
String
name
=
getObjectName
(
object
);
checkDuplicateName
(
name
,
object
);
this
.
objectMap
.
put
(
name
,
object
);
}
this
.
objectList
=
new
ArrayList
<>();
}
detectCaseSensitivity
(
object
);
this
.
objectList
.
add
(
object
);
if
(
this
.
objectMap
!=
null
)
{
String
name
=
getObjectName
(
object
);
checkDuplicateName
(
name
,
object
);
this
.
objectMap
.
put
(
name
,
object
);
}
}
}
...
...
@@ -152,6 +153,34 @@ public abstract class AbstractObjectCache<OWNER extends DBSObject, OBJECT extend
}
}
/**
* Merges new cache with existing.
* If objects with the same name were already cached - leave them in cache
* (because they might be referenced somewhere).
*/
protected
void
mergeCache
(
List
<
OBJECT
>
objects
)
{
synchronized
(
this
)
{
if
(
this
.
objectList
!=
null
)
{
// Merge lists
objects
=
new
ArrayList
<>(
objects
);
for
(
int
i
=
0
;
i
<
objects
.
size
();
i
++)
{
OBJECT
newObject
=
objects
.
get
(
i
);
String
newObjectName
=
getObjectName
(
newObject
);
for
(
int
k
=
0
;
k
<
objectList
.
size
();
k
++)
{
OBJECT
oldObject
=
objectList
.
get
(
k
);
String
oldObjectName
=
getObjectName
(
oldObject
);
if
(
newObjectName
.
equals
(
oldObjectName
))
{
objects
.
set
(
i
,
oldObject
);
break
;
}
}
}
}
}
setCache
(
objects
);
}
private
synchronized
Map
<
String
,
OBJECT
>
getObjectMap
()
{
if
(
this
.
objectMap
==
null
)
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/cache/JDBCObjectCache.java
浏览文件 @
c06ebaa0
...
...
@@ -142,7 +142,7 @@ public abstract class JDBCObjectCache<OWNER extends DBSObject, OBJECT extends DB
synchronized
(
this
)
{
detectCaseSensitivity
(
owner
);
set
Cache
(
tmpObjectList
);
merge
Cache
(
tmpObjectList
);
this
.
invalidateObjects
(
monitor
,
owner
,
new
CacheIterator
());
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录