Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
5a735324
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
5a735324
编写于
1月 10, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#2719 CSV export: option to quote all cell values
上级
a316f1d0
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
10 addition
and
2 deletion
+10
-2
plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
...ns/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
+2
-0
plugins/org.jkiss.dbeaver.core/plugin.xml
plugins/org.jkiss.dbeaver.core/plugin.xml
+1
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/stream/impl/DataExporterCSV.java
...s/dbeaver/tools/transfer/stream/impl/DataExporterCSV.java
+7
-2
未找到文件。
plugins/org.jkiss.dbeaver.core/OSGI-INF/l10n/bundle.properties
浏览文件 @
5a735324
...
...
@@ -398,6 +398,8 @@ dataTransfer.processor.csv.property.escape.name=Characters escape
dataTransfer.processor.csv.property.escape.description
=
Bad characters escaping model (surrounded with quotes or escaped with '
\'
character)
dataTransfer.processor.csv.property.quoteChar.name
=
Quote character
dataTransfer.processor.csv.property.quoteChar.description
=
Character which will bee used to quote strings (space means no quote)
dataTransfer.processor.csv.property.quoteAlways.name
=
Quote always
dataTransfer.processor.csv.property.quoteAlways.description
=
Quote all cell values
dataTransfer.processor.csv.property.nullString.name
=
NULL string
dataTransfer.processor.csv.property.nullString.description
=
String which will be used instead of NULL values
dataTransfer.processor.sql.name
=
SQL
...
...
plugins/org.jkiss.dbeaver.core/plugin.xml
浏览文件 @
5a735324
...
...
@@ -3465,6 +3465,7 @@
<property
id=
"header"
label=
"%dataTransfer.processor.csv.property.header.name"
type=
"string"
description=
"%dataTransfer.processor.csv.property.header.description"
defaultValue=
"top"
required=
"true"
validValues=
"none,top,bottom,both"
/>
<property
id=
"escape"
label=
"%dataTransfer.processor.csv.property.escape.name"
type=
"string"
description=
"%dataTransfer.processor.csv.property.escape.description"
defaultValue=
"quotes"
required=
"true"
validValues=
"quotes,escape"
/>
<property
id=
"quoteChar"
label=
"%dataTransfer.processor.csv.property.quoteChar.name"
type=
"string"
description=
"%dataTransfer.processor.csv.property.quoteChar.description"
defaultValue=
"""
required=
"false"
/>
<property
id=
"quoteAlways"
label=
"%dataTransfer.processor.csv.property.quoteAlways.name"
type=
"boolean"
description=
"%dataTransfer.processor.csv.property.quoteAlways.description"
defaultValue=
"false"
required=
"false"
/>
<property
id=
"nullString"
label=
"%dataTransfer.processor.csv.property.nullString.name"
type=
"string"
description=
"%dataTransfer.processor.csv.property.nullString.description"
defaultValue=
""
required=
"false"
/>
</propertyGroup>
</processor>
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/transfer/stream/impl/DataExporterCSV.java
浏览文件 @
5a735324
...
...
@@ -43,6 +43,7 @@ public class DataExporterCSV extends StreamExporterAbstract {
private
static
final
String
PROP_DELIMITER
=
"delimiter"
;
private
static
final
String
PROP_HEADER
=
"header"
;
private
static
final
String
PROP_QUOTE_CHAR
=
"quoteChar"
;
private
static
final
String
PROP_QUOTE_ALWAYS
=
"quoteAlways"
;
private
static
final
String
PROP_NULL_STRING
=
"nullString"
;
private
static
final
char
DEF_DELIMITER
=
','
;
private
static
final
String
DEF_QUOTE_CHAR
=
"\""
;
...
...
@@ -56,6 +57,7 @@ public class DataExporterCSV extends StreamExporterAbstract {
private
String
delimiter
;
private
char
quoteChar
=
'"'
;
private
boolean
useQuotes
=
true
;
private
boolean
quoteAlways
=
true
;
private
String
rowDelimiter
;
private
String
nullString
;
private
HeaderPosition
headerPosition
;
...
...
@@ -85,6 +87,7 @@ public class DataExporterCSV extends StreamExporterAbstract {
Object
nullStringProp
=
site
.
getProperties
().
get
(
PROP_NULL_STRING
);
nullString
=
nullStringProp
==
null
?
null
:
nullStringProp
.
toString
();
useQuotes
=
quoteChar
!=
' '
;
quoteAlways
=
CommonUtils
.
toBoolean
(
site
.
getProperties
().
get
(
PROP_QUOTE_ALWAYS
));
out
=
site
.
getWriter
();
rowDelimiter
=
GeneralUtils
.
getDefaultLineSeparator
();
try
{
...
...
@@ -185,9 +188,11 @@ public class DataExporterCSV extends StreamExporterAbstract {
}
// check for needed quote
final
boolean
hasQuotes
=
useQuotes
&&
value
.
indexOf
(
quoteChar
)
!=
-
1
;
if
(!
quote
&&
!
value
.
isEmpty
())
{
if
(
quoteAlways
)
{
quote
=
true
;
}
else
if
(!
quote
&&
!
value
.
isEmpty
())
{
if
(
hasQuotes
||
value
.
indexOf
(
delimiter
)
!=
-
1
||
value
.
contains
(
delimiter
)
||
value
.
indexOf
(
'\r'
)
!=
-
1
||
value
.
indexOf
(
'\n'
)
!=
-
1
||
value
.
contains
(
rowDelimiter
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录