Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
d0340587
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,发现更多精彩内容 >>
提交
d0340587
编写于
12月 22, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#4529 MAppings load fix (create/existing - check object existence)
Former-commit-id:
4d46576b
上级
e8517788
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
11 deletion
+45
-11
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseMappingAttribute.java
...ver/tools/transfer/database/DatabaseMappingAttribute.java
+19
-3
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseMappingContainer.java
...ver/tools/transfer/database/DatabaseMappingContainer.java
+25
-7
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferConsumer.java
...ver/tools/transfer/database/DatabaseTransferConsumer.java
+1
-1
未找到文件。
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseMappingAttribute.java
浏览文件 @
d0340587
...
@@ -22,6 +22,7 @@ import org.jkiss.dbeaver.Log;
...
@@ -22,6 +22,7 @@ import org.jkiss.dbeaver.Log;
import
org.jkiss.dbeaver.model.*
;
import
org.jkiss.dbeaver.model.*
;
import
org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer
;
import
org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.SQLDataSource
;
import
org.jkiss.dbeaver.model.sql.SQLDataSource
;
import
org.jkiss.dbeaver.model.sql.SQLDialect
;
import
org.jkiss.dbeaver.model.sql.SQLDialect
;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.model.struct.*
;
...
@@ -272,10 +273,25 @@ public class DatabaseMappingAttribute implements DatabaseMappingObject {
...
@@ -272,10 +273,25 @@ public class DatabaseMappingAttribute implements DatabaseMappingObject {
targetType
=
settings
.
get
(
"targetType"
);
targetType
=
settings
.
get
(
"targetType"
);
if
(
settings
.
get
(
"mappingType"
)
!=
null
)
{
if
(
settings
.
get
(
"mappingType"
)
!=
null
)
{
try
{
try
{
mappingType
=
DatabaseMappingType
.
valueOf
(
settings
.
get
(
"mappingType"
));
DatabaseMappingType
newMappingType
=
DatabaseMappingType
.
valueOf
(
settings
.
get
(
"mappingType"
));
}
catch
(
IllegalArgumentException
e
)
{
if
(!
CommonUtils
.
isEmpty
(
targetName
))
{
DBSDataManipulator
targetEntity
=
parent
.
getTarget
();
if
(
targetEntity
instanceof
DBSEntity
)
{
this
.
target
=
((
DBSEntity
)
targetEntity
).
getAttribute
(
new
VoidProgressMonitor
(),
targetName
);
}
}
if
(
target
!=
null
&&
newMappingType
==
DatabaseMappingType
.
create
)
{
// Change create to existing.
newMappingType
=
DatabaseMappingType
.
existing
;
}
else
if
(
target
==
null
&&
newMappingType
==
DatabaseMappingType
.
existing
)
{
newMappingType
=
DatabaseMappingType
.
create
;
}
setMappingType
(
newMappingType
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
);
log
.
error
(
e
);
mappingType
=
DatabaseMappingType
.
unspecified
;
}
}
}
}
}
}
...
...
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseMappingContainer.java
浏览文件 @
d0340587
...
@@ -44,28 +44,28 @@ public class DatabaseMappingContainer implements DatabaseMappingObject {
...
@@ -44,28 +44,28 @@ public class DatabaseMappingContainer implements DatabaseMappingObject {
private
static
final
Log
log
=
Log
.
getLog
(
DatabaseMappingContainer
.
class
);
private
static
final
Log
log
=
Log
.
getLog
(
DatabaseMappingContainer
.
class
);
private
DatabaseConsumerSettings
s
ettings
;
private
DatabaseConsumerSettings
consumerS
ettings
;
private
DBSDataContainer
source
;
private
DBSDataContainer
source
;
private
DBSDataManipulator
target
;
private
DBSDataManipulator
target
;
private
String
targetName
;
private
String
targetName
;
private
DatabaseMappingType
mappingType
;
private
DatabaseMappingType
mappingType
;
private
List
<
DatabaseMappingAttribute
>
attributeMappings
=
new
ArrayList
<>();
private
List
<
DatabaseMappingAttribute
>
attributeMappings
=
new
ArrayList
<>();
public
DatabaseMappingContainer
(
DatabaseConsumerSettings
s
ettings
,
DBSDataContainer
source
)
{
public
DatabaseMappingContainer
(
DatabaseConsumerSettings
consumerS
ettings
,
DBSDataContainer
source
)
{
this
.
settings
=
s
ettings
;
this
.
consumerSettings
=
consumerS
ettings
;
this
.
source
=
source
;
this
.
source
=
source
;
this
.
mappingType
=
DatabaseMappingType
.
unspecified
;
this
.
mappingType
=
DatabaseMappingType
.
unspecified
;
}
}
public
DatabaseMappingContainer
(
IRunnableContext
context
,
DatabaseConsumerSettings
s
ettings
,
DBSDataContainer
sourceObject
,
DBSDataManipulator
targetObject
)
throws
DBException
{
public
DatabaseMappingContainer
(
IRunnableContext
context
,
DatabaseConsumerSettings
consumerS
ettings
,
DBSDataContainer
sourceObject
,
DBSDataManipulator
targetObject
)
throws
DBException
{
this
.
settings
=
s
ettings
;
this
.
consumerSettings
=
consumerS
ettings
;
this
.
source
=
sourceObject
;
this
.
source
=
sourceObject
;
this
.
target
=
targetObject
;
this
.
target
=
targetObject
;
refreshMappingType
(
context
,
DatabaseMappingType
.
existing
);
refreshMappingType
(
context
,
DatabaseMappingType
.
existing
);
}
}
public
DatabaseConsumerSettings
getSettings
()
{
public
DatabaseConsumerSettings
getSettings
()
{
return
s
ettings
;
return
consumerS
ettings
;
}
}
@Override
@Override
...
@@ -222,7 +222,25 @@ public class DatabaseMappingContainer implements DatabaseMappingObject {
...
@@ -222,7 +222,25 @@ public class DatabaseMappingContainer implements DatabaseMappingObject {
targetName
=
settings
.
get
(
"targetName"
);
targetName
=
settings
.
get
(
"targetName"
);
if
(
settings
.
get
(
"mappingType"
)
!=
null
)
{
if
(
settings
.
get
(
"mappingType"
)
!=
null
)
{
try
{
try
{
refreshMappingType
(
context
,
DatabaseMappingType
.
valueOf
(
settings
.
get
(
"mappingType"
)));
DatabaseMappingType
newMappingType
=
DatabaseMappingType
.
valueOf
(
settings
.
get
(
"mappingType"
));
if
(!
CommonUtils
.
isEmpty
(
targetName
))
{
DBSObjectContainer
objectContainer
=
consumerSettings
.
getContainer
();
if
(
objectContainer
!=
null
)
{
DBSObject
child
=
objectContainer
.
getChild
(
new
VoidProgressMonitor
(),
targetName
);
if
(
child
instanceof
DBSDataManipulator
)
{
target
=
(
DBSDataManipulator
)
child
;
}
}
}
if
(
target
!=
null
&&
newMappingType
==
DatabaseMappingType
.
create
)
{
// Change create to existing.
newMappingType
=
DatabaseMappingType
.
existing
;
}
else
if
(
target
==
null
&&
newMappingType
==
DatabaseMappingType
.
existing
)
{
newMappingType
=
DatabaseMappingType
.
create
;
}
refreshMappingType
(
context
,
newMappingType
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
);
log
.
error
(
e
);
}
}
...
...
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferConsumer.java
浏览文件 @
d0340587
...
@@ -170,7 +170,7 @@ public class DatabaseTransferConsumer implements IDataTransferConsumer<DatabaseC
...
@@ -170,7 +170,7 @@ public class DatabaseTransferConsumer implements IDataTransferConsumer<DatabaseC
Object
[]
rowValues
=
new
Object
[
targetAttributes
.
size
()];
Object
[]
rowValues
=
new
Object
[
targetAttributes
.
size
()];
for
(
int
i
=
0
;
i
<
columnMappings
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnMappings
.
length
;
i
++)
{
ColumnMapping
column
=
columnMappings
[
i
];
ColumnMapping
column
=
columnMappings
[
i
];
if
(
column
.
targetIndex
<
0
)
{
if
(
column
==
null
||
column
.
targetIndex
<
0
)
{
continue
;
continue
;
}
}
final
Object
attrValue
;
final
Object
attrValue
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录