Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
45e42b12
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,发现更多精彩内容 >>
提交
45e42b12
编写于
4月 23, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3025 Truncate table option
Former-commit-id:
95311e4a
上级
948d01a9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
62 addition
and
68 deletion
+62
-68
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseConsumerPageLoadSettings.java
...s/transfer/database/DatabaseConsumerPageLoadSettings.java
+17
-7
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseConsumerSettings.java
...ver/tools/transfer/database/DatabaseConsumerSettings.java
+45
-61
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseConsumerPageLoadSettings.java
浏览文件 @
45e42b12
...
...
@@ -52,22 +52,34 @@ public class DatabaseConsumerPageLoadSettings extends ActiveWizardPage<DataTrans
final
DatabaseConsumerSettings
settings
=
getWizard
().
getPageSettings
(
this
,
DatabaseConsumerSettings
.
class
);
{
Group
loadSettings
=
UIUtils
.
createControlGroup
(
composite
,
"Data load"
,
1
,
GridData
.
FILL_HORIZONTAL
,
0
);
final
Button
truncateTargetTable
=
UIUtils
.
createCheckbox
(
loadSettings
,
"Truncate target table before load"
,
settings
.
isTruncateBeforeLoad
());
truncateTargetTable
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
settings
.
setTruncateBeforeLoad
(
truncateTargetTable
.
getSelection
());
}
});
}
{
Group
performanceSettings
=
UIUtils
.
createControlGroup
(
composite
,
"Performance"
,
4
,
GridData
.
FILL_HORIZONTAL
,
0
);
final
Button
newConnectionCheckbox
=
UIUtils
.
create
Label
Checkbox
(
final
Button
newConnectionCheckbox
=
UIUtils
.
createCheckbox
(
performanceSettings
,
CoreMessages
.
data_transfer_wizard_output_checkbox_new_connection
,
settings
.
isOpenNewConnections
());
null
,
settings
.
isOpenNewConnections
(),
4
);
newConnectionCheckbox
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
settings
.
setOpenNewConnections
(
newConnectionCheckbox
.
getSelection
());
}
});
newConnectionCheckbox
.
setLayoutData
(
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
false
,
false
,
3
,
1
));
final
Button
useTransactionsCheck
=
UIUtils
.
create
LabelCheckbox
(
performanceSettings
,
"Use transactions"
,
settings
.
isUseTransactions
()
);
final
Button
useTransactionsCheck
=
UIUtils
.
create
Checkbox
(
performanceSettings
,
"Use transactions"
,
null
,
settings
.
isUseTransactions
(),
4
);
useTransactionsCheck
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
...
...
@@ -75,7 +87,6 @@ public class DatabaseConsumerPageLoadSettings extends ActiveWizardPage<DataTrans
settings
.
setUseTransactions
(
useTransactionsCheck
.
getSelection
());
}
});
useTransactionsCheck
.
setLayoutData
(
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
false
,
false
,
3
,
1
));
final
Spinner
commitAfterEdit
=
UIUtils
.
createLabelSpinner
(
performanceSettings
,
"Commit after insert of "
,
settings
.
getCommitAfterRows
(),
1
,
Integer
.
MAX_VALUE
);
commitAfterEdit
.
addSelectionListener
(
new
SelectionAdapter
()
{
...
...
@@ -90,14 +101,13 @@ public class DatabaseConsumerPageLoadSettings extends ActiveWizardPage<DataTrans
{
Group
generalSettings
=
UIUtils
.
createControlGroup
(
composite
,
"General"
,
4
,
GridData
.
FILL_HORIZONTAL
,
0
);
final
Button
showTableCheckbox
=
UIUtils
.
create
LabelCheckbox
(
generalSettings
,
"Open table editor on finish"
,
settings
.
isOpenTableOnFinish
()
);
final
Button
showTableCheckbox
=
UIUtils
.
create
Checkbox
(
generalSettings
,
"Open table editor on finish"
,
null
,
settings
.
isOpenTableOnFinish
(),
4
);
showTableCheckbox
.
addSelectionListener
(
new
SelectionAdapter
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
settings
.
setOpenTableOnFinish
(
showTableCheckbox
.
getSelection
());
}
});
showTableCheckbox
.
setLayoutData
(
new
GridData
(
GridData
.
HORIZONTAL_ALIGN_BEGINNING
,
GridData
.
VERTICAL_ALIGN_BEGINNING
,
false
,
false
,
3
,
1
));
}
setControl
(
composite
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseConsumerSettings.java
浏览文件 @
45e42b12
...
...
@@ -16,10 +16,8 @@
*/
package
org.jkiss.dbeaver.tools.transfer.database
;
import
org.eclipse.core.runtime.IProgressMonitor
;
import
org.eclipse.jface.dialogs.IDialogSettings
;
import
org.eclipse.jface.operation.IRunnableContext
;
import
org.eclipse.jface.operation.IRunnableWithProgress
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
...
...
@@ -61,51 +59,44 @@ public class DatabaseConsumerSettings implements IDataTransferSettings {
private
boolean
openNewConnections
=
true
;
private
boolean
useTransactions
=
true
;
private
int
commitAfterRows
=
10000
;
private
boolean
truncateBeforeLoad
=
false
;
private
boolean
openTableOnFinish
=
true
;
public
DatabaseConsumerSettings
()
{
public
DatabaseConsumerSettings
()
{
}
@Nullable
public
DBSObjectContainer
getContainer
()
{
public
DBSObjectContainer
getContainer
()
{
if
(
containerNode
==
null
)
{
return
null
;
}
return
DBUtils
.
getAdapter
(
DBSObjectContainer
.
class
,
containerNode
.
getObject
());
}
public
DBNDatabaseNode
getContainerNode
()
{
public
DBNDatabaseNode
getContainerNode
()
{
return
containerNode
;
}
public
void
setContainerNode
(
DBNDatabaseNode
containerNode
)
{
public
void
setContainerNode
(
DBNDatabaseNode
containerNode
)
{
this
.
containerNode
=
containerNode
;
}
public
Map
<
DBSDataContainer
,
DatabaseMappingContainer
>
getDataMappings
()
{
public
Map
<
DBSDataContainer
,
DatabaseMappingContainer
>
getDataMappings
()
{
return
dataMappings
;
}
public
DatabaseMappingContainer
getDataMapping
(
DBSDataContainer
dataContainer
)
{
public
DatabaseMappingContainer
getDataMapping
(
DBSDataContainer
dataContainer
)
{
return
dataMappings
.
get
(
dataContainer
);
}
public
boolean
isCompleted
(
Collection
<
DataTransferPipe
>
pipes
)
{
public
boolean
isCompleted
(
Collection
<
DataTransferPipe
>
pipes
)
{
for
(
DataTransferPipe
pipe
:
pipes
)
{
if
(
pipe
.
getProducer
()
!=
null
)
{
DBSDataContainer
sourceObject
=
(
DBSDataContainer
)
pipe
.
getProducer
().
getSourceObject
();
DBSDataContainer
sourceObject
=
(
DBSDataContainer
)
pipe
.
getProducer
().
getSourceObject
();
DatabaseMappingContainer
containerMapping
=
dataMappings
.
get
(
sourceObject
);
if
(
containerMapping
==
null
||
containerMapping
.
getMappingType
()
==
DatabaseMappingType
.
unspecified
||
!
containerMapping
.
isCompleted
())
{
!
containerMapping
.
isCompleted
())
{
return
false
;
}
}
...
...
@@ -113,49 +104,48 @@ public class DatabaseConsumerSettings implements IDataTransferSettings {
return
true
;
}
public
boolean
isOpenTableOnFinish
()
{
public
boolean
isTruncateBeforeLoad
()
{
return
truncateBeforeLoad
;
}
public
void
setTruncateBeforeLoad
(
boolean
truncateBeforeLoad
)
{
this
.
truncateBeforeLoad
=
truncateBeforeLoad
;
}
public
boolean
isOpenTableOnFinish
()
{
return
openTableOnFinish
;
}
public
void
setOpenTableOnFinish
(
boolean
openTableOnFinish
)
{
public
void
setOpenTableOnFinish
(
boolean
openTableOnFinish
)
{
this
.
openTableOnFinish
=
openTableOnFinish
;
}
public
boolean
isOpenNewConnections
()
{
public
boolean
isOpenNewConnections
()
{
return
openNewConnections
;
}
public
void
setOpenNewConnections
(
boolean
openNewConnections
)
{
public
void
setOpenNewConnections
(
boolean
openNewConnections
)
{
this
.
openNewConnections
=
openNewConnections
;
}
public
boolean
isUseTransactions
()
{
public
boolean
isUseTransactions
()
{
return
useTransactions
;
}
public
void
setUseTransactions
(
boolean
useTransactions
)
{
public
void
setUseTransactions
(
boolean
useTransactions
)
{
this
.
useTransactions
=
useTransactions
;
}
public
int
getCommitAfterRows
()
{
public
int
getCommitAfterRows
()
{
return
commitAfterRows
;
}
public
void
setCommitAfterRows
(
int
commitAfterRows
)
{
public
void
setCommitAfterRows
(
int
commitAfterRows
)
{
this
.
commitAfterRows
=
commitAfterRows
;
}
@Nullable
DBPDataSource
getTargetDataSource
(
DatabaseMappingObject
attrMapping
)
{
DBPDataSource
getTargetDataSource
(
DatabaseMappingObject
attrMapping
)
{
DBSObjectContainer
container
=
getContainer
();
if
(
container
!=
null
)
{
return
container
.
getDataSource
();
...
...
@@ -167,8 +157,7 @@ public class DatabaseConsumerSettings implements IDataTransferSettings {
}
@Override
public
void
loadSettings
(
IRunnableContext
runnableContext
,
DataTransferSettings
dataTransferSettings
,
IDialogSettings
dialogSettings
)
{
public
void
loadSettings
(
IRunnableContext
runnableContext
,
DataTransferSettings
dataTransferSettings
,
IDialogSettings
dialogSettings
)
{
containerNodePath
=
dialogSettings
.
get
(
"container"
);
if
(
dialogSettings
.
get
(
"openNewConnections"
)
!=
null
)
{
openNewConnections
=
dialogSettings
.
getBoolean
(
"openNewConnections"
);
...
...
@@ -179,6 +168,9 @@ public class DatabaseConsumerSettings implements IDataTransferSettings {
if
(
dialogSettings
.
get
(
"commitAfterRows"
)
!=
null
)
{
commitAfterRows
=
dialogSettings
.
getInt
(
"commitAfterRows"
);
}
if
(
dialogSettings
.
get
(
"truncateBeforeLoad"
)
!=
null
)
{
truncateBeforeLoad
=
dialogSettings
.
getBoolean
(
"truncateBeforeLoad"
);
}
if
(
dialogSettings
.
get
(
"openTableOnFinish"
)
!=
null
)
{
openTableOnFinish
=
dialogSettings
.
getBoolean
(
"openTableOnFinish"
);
}
...
...
@@ -204,12 +196,8 @@ public class DatabaseConsumerSettings implements IDataTransferSettings {
// then we need to check connection
if
(
containerNode
instanceof
DBNDataSource
&&
containerNode
.
getDataSource
()
==
null
)
{
try
{
runnableContext
.
run
(
true
,
true
,
new
IRunnableWithProgress
()
{
@Override
public
void
run
(
IProgressMonitor
monitor
)
throws
InvocationTargetException
,
InterruptedException
{
containerNode
.
initializeNode
(
new
DefaultProgressMonitor
(
monitor
),
null
);
}
});
runnableContext
.
run
(
true
,
true
,
monitor
->
containerNode
.
initializeNode
(
new
DefaultProgressMonitor
(
monitor
),
null
));
}
catch
(
InvocationTargetException
e
)
{
DBUserInterface
.
getInstance
().
showError
(
"Init connection"
,
"Error connecting to datasource"
,
e
.
getTargetException
());
}
catch
(
InterruptedException
e
)
{
...
...
@@ -219,20 +207,19 @@ public class DatabaseConsumerSettings implements IDataTransferSettings {
}
@Override
public
void
saveSettings
(
IDialogSettings
dialogSettings
)
{
public
void
saveSettings
(
IDialogSettings
dialogSettings
)
{
if
(
containerNode
!=
null
)
{
dialogSettings
.
put
(
"container"
,
containerNode
.
getNodeItemPath
());
}
dialogSettings
.
put
(
"openNewConnections"
,
openNewConnections
);
dialogSettings
.
put
(
"useTransactions"
,
useTransactions
);
dialogSettings
.
put
(
"commitAfterRows"
,
commitAfterRows
);
dialogSettings
.
put
(
"truncateBeforeLoad"
,
truncateBeforeLoad
);
dialogSettings
.
put
(
"openTableOnFinish"
,
openTableOnFinish
);
}
@NotNull
public
String
getContainerFullName
()
{
public
String
getContainerFullName
()
{
DBSObjectContainer
container
=
getContainer
();
return
container
==
null
?
""
:
container
instanceof
DBPDataSource
?
...
...
@@ -244,19 +231,16 @@ public class DatabaseConsumerSettings implements IDataTransferSettings {
if
(
containerNode
==
null
&&
!
CommonUtils
.
isEmpty
(
containerNodePath
))
{
if
(!
CommonUtils
.
isEmpty
(
containerNodePath
))
{
try
{
runnableContext
.
run
(
true
,
true
,
new
IRunnableWithProgress
()
{
@Override
public
void
run
(
IProgressMonitor
monitor
)
throws
InvocationTargetException
,
InterruptedException
{
try
{
DBNNode
node
=
DBeaverCore
.
getInstance
().
getNavigatorModel
().
getNodeByPath
(
new
DefaultProgressMonitor
(
monitor
),
containerNodePath
);
if
(
node
instanceof
DBNDatabaseNode
)
{
containerNode
=
(
DBNDatabaseNode
)
node
;
}
}
catch
(
DBException
e
)
{
throw
new
InvocationTargetException
(
e
);
runnableContext
.
run
(
true
,
true
,
monitor
->
{
try
{
DBNNode
node
=
DBeaverCore
.
getInstance
().
getNavigatorModel
().
getNodeByPath
(
new
DefaultProgressMonitor
(
monitor
),
containerNodePath
);
if
(
node
instanceof
DBNDatabaseNode
)
{
containerNode
=
(
DBNDatabaseNode
)
node
;
}
}
catch
(
DBException
e
)
{
throw
new
InvocationTargetException
(
e
);
}
});
checkContainerConnection
(
runnableContext
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录