Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
9f1754db
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,发现更多精彩内容 >>
提交
9f1754db
编写于
6月 15, 2017
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1776 Advanced copy: quote character config
Former-commit-id:
dd712105
上级
e7461f3b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
34 addition
and
5 deletion
+34
-5
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetCommandHandler.java
...beaver/ui/controls/resultset/ResultSetCommandHandler.java
+2
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetCopySettings.java
.../dbeaver/ui/controls/resultset/ResultSetCopySettings.java
+11
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetCopySpecialHandler.java
...er/ui/controls/resultset/ResultSetCopySpecialHandler.java
+9
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
...ntrols/resultset/spreadsheet/SpreadsheetPresentation.java
+6
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
...eaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
+6
-0
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetCommandHandler.java
浏览文件 @
9f1754db
...
...
@@ -281,7 +281,7 @@ public class ResultSetCommandHandler extends AbstractHandler {
case
IWorkbenchCommandConstants
.
EDIT_COPY
:
ResultSetUtils
.
copyToClipboard
(
presentation
.
copySelectionToString
(
new
ResultSetCopySettings
(
false
,
false
,
false
,
true
,
null
,
null
,
DBDDisplayFormat
.
EDIT
)));
new
ResultSetCopySettings
(
false
,
false
,
false
,
true
,
null
,
null
,
null
,
DBDDisplayFormat
.
EDIT
)));
break
;
case
IWorkbenchCommandConstants
.
EDIT_PASTE
:
case
CoreCommands
.
CMD_PASTE_SPECIAL
:
...
...
@@ -292,7 +292,7 @@ public class ResultSetCommandHandler extends AbstractHandler {
case
IWorkbenchCommandConstants
.
EDIT_CUT
:
ResultSetUtils
.
copyToClipboard
(
presentation
.
copySelectionToString
(
new
ResultSetCopySettings
(
false
,
false
,
true
,
true
,
null
,
null
,
DBDDisplayFormat
.
EDIT
))
new
ResultSetCopySettings
(
false
,
false
,
true
,
true
,
null
,
null
,
null
,
DBDDisplayFormat
.
EDIT
))
);
break
;
case
IWorkbenchCommandConstants
.
FILE_PRINT
:
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetCopySettings.java
浏览文件 @
9f1754db
...
...
@@ -28,18 +28,20 @@ public class ResultSetCopySettings {
private
boolean
quoteCells
;
private
String
columnDelimiter
;
private
String
rowDelimiter
;
private
String
quoteString
;
private
DBDDisplayFormat
format
;
public
ResultSetCopySettings
()
{
}
public
ResultSetCopySettings
(
boolean
copyHeader
,
boolean
copyRowNumbers
,
boolean
cut
,
boolean
quoteCells
,
String
columnDelimiter
,
String
rowDelimiter
,
DBDDisplayFormat
format
)
{
public
ResultSetCopySettings
(
boolean
copyHeader
,
boolean
copyRowNumbers
,
boolean
cut
,
boolean
quoteCells
,
String
columnDelimiter
,
String
rowDelimiter
,
String
quoteString
,
DBDDisplayFormat
format
)
{
this
.
copyHeader
=
copyHeader
;
this
.
copyRowNumbers
=
copyRowNumbers
;
this
.
cut
=
cut
;
this
.
quoteCells
=
quoteCells
;
this
.
columnDelimiter
=
columnDelimiter
;
this
.
rowDelimiter
=
rowDelimiter
;
this
.
quoteString
=
quoteString
==
null
?
"\""
:
quoteString
;
this
.
format
=
format
;
}
...
...
@@ -91,6 +93,14 @@ public class ResultSetCopySettings {
this
.
rowDelimiter
=
rowDelimiter
;
}
public
String
getQuoteString
()
{
return
quoteString
;
}
public
void
setQuoteString
(
String
quoteString
)
{
this
.
quoteString
=
quoteString
;
}
public
DBDDisplayFormat
getFormat
()
{
return
format
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetCopySpecialHandler.java
浏览文件 @
9f1754db
...
...
@@ -77,6 +77,7 @@ public class ResultSetCopySpecialHandler extends ResultSetCommandHandler impleme
static
final
String
PARAM_FORMAT
=
"format"
;
static
final
String
PARAM_COL_DELIMITER
=
"delimiter"
;
static
final
String
PARAM_ROW_DELIMITER
=
"rowDelimiter"
;
static
final
String
PARAM_QUOTE_STRING
=
"quoteString"
;
private
final
IDialogSettings
settings
;
...
...
@@ -86,6 +87,7 @@ public class ResultSetCopySpecialHandler extends ResultSetCommandHandler impleme
private
ValueFormatSelector
formatSelector
;
private
Combo
colDelimCombo
;
private
Combo
rowDelimCombo
;
private
Combo
quoteStringCombo
;
private
ResultSetCopySettings
copySettings
;
...
...
@@ -100,6 +102,7 @@ public class ResultSetCopySpecialHandler extends ResultSetCommandHandler impleme
copySettings
.
setFormat
(
DBDDisplayFormat
.
UI
);
copySettings
.
setColumnDelimiter
(
"\t"
);
copySettings
.
setRowDelimiter
(
"\n"
);
copySettings
.
setQuoteString
(
"\""
);
if
(
settings
.
get
(
PARAM_COPY_HEADER
)
!=
null
)
{
copySettings
.
setCopyHeader
(
settings
.
getBoolean
(
PARAM_COPY_HEADER
));
}
...
...
@@ -118,6 +121,9 @@ public class ResultSetCopySpecialHandler extends ResultSetCommandHandler impleme
if
(
settings
.
get
(
PARAM_ROW_DELIMITER
)
!=
null
)
{
copySettings
.
setRowDelimiter
(
settings
.
get
(
PARAM_ROW_DELIMITER
));
}
if
(
settings
.
get
(
PARAM_QUOTE_STRING
)
!=
null
)
{
copySettings
.
setQuoteString
(
settings
.
get
(
PARAM_QUOTE_STRING
));
}
}
@Override
...
...
@@ -141,6 +147,7 @@ public class ResultSetCopySpecialHandler extends ResultSetCommandHandler impleme
colDelimCombo
=
createDelimiterCombo
(
group
,
"Column Delimiter"
,
new
String
[]
{
"\t"
,
";"
,
","
},
copySettings
.
getColumnDelimiter
());
rowDelimCombo
=
createDelimiterCombo
(
group
,
"Row Delimiter"
,
new
String
[]
{
"\n"
,
"|"
,
"^"
},
copySettings
.
getRowDelimiter
());
quoteStringCombo
=
createDelimiterCombo
(
group
,
"Quote Character"
,
new
String
[]
{
"\""
,
"'"
},
copySettings
.
getQuoteString
());
return
group
;
}
...
...
@@ -175,6 +182,7 @@ public class ResultSetCopySpecialHandler extends ResultSetCommandHandler impleme
copySettings
.
setFormat
(
formatSelector
.
getSelection
());
copySettings
.
setColumnDelimiter
(
CommonUtils
.
unescapeDisplayString
(
colDelimCombo
.
getText
()));
copySettings
.
setRowDelimiter
(
CommonUtils
.
unescapeDisplayString
(
rowDelimCombo
.
getText
()));
copySettings
.
setQuoteString
(
CommonUtils
.
unescapeDisplayString
(
quoteStringCombo
.
getText
()));
settings
.
put
(
PARAM_COPY_HEADER
,
copySettings
.
isCopyHeader
());
settings
.
put
(
PARAM_COPY_ROWS
,
copySettings
.
isCopyRowNumbers
());
...
...
@@ -182,6 +190,7 @@ public class ResultSetCopySpecialHandler extends ResultSetCommandHandler impleme
settings
.
put
(
PARAM_FORMAT
,
copySettings
.
getFormat
().
name
());
settings
.
put
(
PARAM_COL_DELIMITER
,
copySettings
.
getColumnDelimiter
());
settings
.
put
(
PARAM_ROW_DELIMITER
,
copySettings
.
getRowDelimiter
());
settings
.
put
(
PARAM_QUOTE_STRING
,
copySettings
.
getQuoteString
());
super
.
okPressed
();
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
浏览文件 @
9f1754db
...
...
@@ -386,6 +386,10 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
if
(
rowDelimiter
==
null
)
{
rowDelimiter
=
GeneralUtils
.
getDefaultLineSeparator
();
}
String
quoteString
=
settings
.
getQuoteString
();
if
((
CommonUtils
.
isEmpty
(
quoteString
)))
{
quoteString
=
"\""
;
}
List
<
Object
>
selectedColumns
=
spreadsheet
.
getColumnSelection
();
IGridLabelProvider
labelProvider
=
spreadsheet
.
getLabelProvider
();
StringBuilder
tdt
=
new
StringBuilder
();
...
...
@@ -439,9 +443,9 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
column
.
getAttribute
(),
value
,
settings
.
getFormat
());
if
(
quoteCells
&&
cellText
!=
null
)
{
if
(
quoteCells
&&
!
CommonUtils
.
isEmpty
(
cellText
)
)
{
if
(
cellText
.
contains
(
columnDelimiter
)
||
cellText
.
contains
(
rowDelimiter
))
{
cellText
=
'"'
+
cellText
+
'"'
;
cellText
=
quoteString
+
cellText
+
quoteString
;
}
}
tdt
.
append
(
cellText
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
浏览文件 @
9f1754db
...
...
@@ -592,6 +592,12 @@ public final class SQLUtils {
int
precision
=
column
.
getPrecision
();
if
(
precision
==
0
)
{
precision
=
(
int
)
column
.
getMaxLength
();
if
(
precision
>
0
)
{
// FIXME: max length is actually length in character.
// FIXME: On Oracle it returns bigger values than maximum (#1767)
// FIXME: in other DBs it equals to precision in most cases
//precision--; // One character for sign?
}
}
if
(
scale
>=
0
&&
precision
>=
0
&&
!(
scale
==
0
&&
precision
==
0
))
{
return
"("
+
precision
+
','
+
scale
+
')'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录