Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
bb262cd3
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,发现更多精彩内容 >>
提交
bb262cd3
编写于
7月 02, 2021
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/devel' into devel
上级
1bac7ae5
29fe5714
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
197 addition
and
225 deletion
+197
-225
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
+14
-0
plugins/org.jkiss.dbeaver.data.transfer.ui/src/org/jkiss/dbeaver/tools/transfer/ui/pages/database/ColumnsMappingDialog.java
...ools/transfer/ui/pages/database/ColumnsMappingDialog.java
+149
-173
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/stream/exporter/DataExporterHTML.java
...aver/tools/transfer/stream/exporter/DataExporterHTML.java
+10
-40
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSchema.java
.../src/org/jkiss/dbeaver/ext/oracle/model/OracleSchema.java
+5
-5
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleStructureAssistant.java
...ss/dbeaver/ext/oracle/model/OracleStructureAssistant.java
+17
-5
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
...eaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
+1
-1
test/org.jkiss.dbeaver.test.platform/src/org/jkiss/dbeaver/model/sql/format/tokenized/SQLFormatterTokenizedTest.java
...model/sql/format/tokenized/SQLFormatterTokenizedTest.java
+1
-1
未找到文件。
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
浏览文件 @
bb262cd3
...
...
@@ -916,4 +916,18 @@ public class CommonUtils {
public
static
boolean
isValidIndex
(
int
index
,
int
length
)
{
return
index
>=
0
||
index
<
length
;
}
@NotNull
public
static
String
escapeHtml
(
@Nullable
String
text
)
{
if
(
text
==
null
)
{
return
" "
;
}
return
text
.
replace
(
"&"
,
"&"
)
.
replace
(
"<"
,
"<"
)
.
replace
(
">"
,
">"
)
.
replace
(
"\r\n"
,
"<br>"
)
.
replace
(
"\r"
,
"<br>"
)
.
replace
(
"\n"
,
"<br>"
);
}
}
plugins/org.jkiss.dbeaver.data.transfer.ui/src/org/jkiss/dbeaver/tools/transfer/ui/pages/database/ColumnsMappingDialog.java
浏览文件 @
bb262cd3
...
...
@@ -47,6 +47,7 @@ import org.jkiss.dbeaver.ui.SharedTextColors;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.CustomComboBoxCellEditor
;
import
org.jkiss.dbeaver.ui.controls.ListContentProvider
;
import
org.jkiss.dbeaver.ui.controls.ViewerColumnController
;
import
org.jkiss.dbeaver.ui.dialogs.BaseDialog
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -135,41 +136,29 @@ class ColumnsMappingDialog extends BaseDialog {
}
});
{
TableViewerColumn
columnSource
=
new
TableViewerColumn
(
mappingViewer
,
SWT
.
LEFT
);
columnSource
.
setLabelProvider
(
new
Cell
LabelProvider
()
{
final
ViewerColumnController
<?,
?>
columnController
=
new
ViewerColumnController
<>(
getClass
().
getName
(),
mappingViewer
);
columnController
.
addColumn
(
DTUIMessages
.
columns_mapping_dialog_column_source_text
,
null
,
SWT
.
LEFT
,
true
,
false
,
new
Column
LabelProvider
()
{
@Override
public
void
update
(
ViewerCell
cell
)
{
DatabaseMappingAttribute
attrMapping
=
(
DatabaseMappingAttribute
)
cell
.
getElement
();
cell
.
setText
(
DBUtils
.
getObjectFullName
(
attrMapping
.
getSource
(),
DBPEvaluationContext
.
UI
));
if
(
attrMapping
.
getIcon
()
!=
null
)
{
cell
.
setImage
(
DBeaverIcons
.
getImage
(
attrMapping
.
getIcon
()));
public
void
update
(
ViewerCell
cell
)
{
DatabaseMappingAttribute
mapping
=
(
DatabaseMappingAttribute
)
cell
.
getElement
();
cell
.
setText
(
DBUtils
.
getObjectFullName
(
mapping
.
getSource
(),
DBPEvaluationContext
.
UI
));
if
(
mapping
.
getIcon
()
!=
null
)
{
cell
.
setImage
(
DBeaverIcons
.
getImage
(
mapping
.
getIcon
()));
}
}
});
columnSource
.
getColumn
().
setText
(
DTUIMessages
.
columns_mapping_dialog_column_source_text
);
columnSource
.
getColumn
().
setWidth
(
170
);
}
{
TableViewerColumn
columnSourceType
=
new
TableViewerColumn
(
mappingViewer
,
SWT
.
LEFT
);
columnSourceType
.
setLabelProvider
(
new
CellLabelProvider
()
{
columnController
.
addColumn
(
DTUIMessages
.
columns_mapping_dialog_column_source_type_text
,
null
,
SWT
.
LEFT
,
true
,
false
,
new
ColumnLabelProvider
()
{
@Override
public
void
update
(
ViewerCell
cell
)
{
public
void
update
(
ViewerCell
cell
)
{
cell
.
setText
(((
DatabaseMappingAttribute
)
cell
.
getElement
()).
getSourceType
());
}
});
columnSourceType
.
getColumn
().
setText
(
DTUIMessages
.
columns_mapping_dialog_column_source_type_text
);
columnSourceType
.
getColumn
().
setWidth
(
100
);
}
{
TableViewerColumn
columnTarget
=
new
TableViewerColumn
(
mappingViewer
,
SWT
.
LEFT
);
columnTarget
.
setLabelProvider
(
new
CellLabelProvider
()
{
columnController
.
addColumn
(
DTUIMessages
.
columns_mapping_dialog_column_target_text
,
null
,
SWT
.
LEFT
,
true
,
false
,
false
,
null
,
new
ColumnLabelProvider
()
{
@Override
public
void
update
(
ViewerCell
cell
)
{
public
void
update
(
ViewerCell
cell
)
{
DatabaseMappingAttribute
mapping
=
(
DatabaseMappingAttribute
)
cell
.
getElement
();
cell
.
setText
(
mapping
.
getTargetName
());
if
(
mapping
.
getMappingType
()
==
DatabaseMappingType
.
unspecified
)
{
...
...
@@ -179,10 +168,7 @@ class ColumnsMappingDialog extends BaseDialog {
}
cell
.
setFont
(
boldFont
);
}
});
columnTarget
.
getColumn
().
setText
(
DTUIMessages
.
columns_mapping_dialog_column_target_text
);
columnTarget
.
getColumn
().
setWidth
(
170
);
columnTarget
.
setEditingSupport
(
new
EditingSupport
(
mappingViewer
)
{
},
new
EditingSupport
(
mappingViewer
)
{
@Override
protected
CellEditor
getCellEditor
(
Object
element
)
{
...
...
@@ -254,23 +240,16 @@ class ColumnsMappingDialog extends BaseDialog {
}
}
});
}
{
TableViewerColumn
columnTargetType
=
new
TableViewerColumn
(
mappingViewer
,
SWT
.
LEFT
);
columnTargetType
.
setLabelProvider
(
new
CellLabelProvider
()
{
columnController
.
addColumn
(
DTUIMessages
.
columns_mapping_dialog_column_target_type_text
,
null
,
SWT
.
LEFT
,
true
,
false
,
false
,
null
,
new
ColumnLabelProvider
()
{
@Override
public
void
update
(
ViewerCell
cell
)
{
public
void
update
(
ViewerCell
cell
)
{
DatabaseMappingAttribute
attrMapping
=
(
DatabaseMappingAttribute
)
cell
.
getElement
();
DBPDataSource
dataSource
=
settings
.
getTargetDataSource
(
attrMapping
);
cell
.
setText
(
attrMapping
.
getTargetType
(
dataSource
,
true
));
cell
.
setFont
(
boldFont
);
}
});
columnTargetType
.
getColumn
().
setText
(
DTUIMessages
.
columns_mapping_dialog_column_target_type_text
);
columnTargetType
.
getColumn
().
setWidth
(
100
);
columnTargetType
.
setEditingSupport
(
new
EditingSupport
(
mappingViewer
)
{
},
new
EditingSupport
(
mappingViewer
)
{
@Override
protected
CellEditor
getCellEditor
(
Object
element
)
{
...
...
@@ -306,28 +285,25 @@ class ColumnsMappingDialog extends BaseDialog {
mappingViewer
.
refresh
(
element
);
}
});
}
{
TableViewerColumn
columnType
=
new
TableViewerColumn
(
mappingViewer
,
SWT
.
LEFT
);
columnType
.
setLabelProvider
(
new
CellLabelProvider
()
{
columnController
.
addColumn
(
DTUIMessages
.
columns_mapping_dialog_column_type_text_mapping
,
null
,
SWT
.
LEFT
,
true
,
false
,
new
ColumnLabelProvider
()
{
@Override
public
void
update
(
ViewerCell
cell
)
{
DatabaseMappingAttribute
mapping
=
(
DatabaseMappingAttribute
)
cell
.
getElement
();
String
text
=
""
;
public
String
getText
(
Object
element
)
{
DatabaseMappingAttribute
mapping
=
(
DatabaseMappingAttribute
)
element
;
switch
(
mapping
.
getMappingType
())
{
case
unspecified:
text
=
"?"
;
break
;
case
existing:
text
=
DTUIMessages
.
columns_mapping_dialog_cell_text_existing
;
break
;
case
create:
text
=
DTUIMessages
.
columns_mapping_dialog_cell_text_new
;
break
;
case
skip:
text
=
DTUIMessages
.
columns_mapping_dialog_cell_text_skip
;
break
;
case
existing:
return
DTUIMessages
.
columns_mapping_dialog_cell_text_existing
;
case
create:
return
DTUIMessages
.
columns_mapping_dialog_cell_text_new
;
case
skip:
return
DTUIMessages
.
columns_mapping_dialog_cell_text_skip
;
default
:
return
"?"
;
}
cell
.
setText
(
text
);
}
});
columnType
.
getColumn
().
setText
(
DTUIMessages
.
columns_mapping_dialog_column_type_text_mapping
);
columnType
.
getColumn
().
setWidth
(
60
);
}
columnController
.
createColumns
();
mappingViewer
.
setInput
(
attributeMappings
);
...
...
plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/stream/exporter/DataExporterHTML.java
浏览文件 @
bb262cd3
...
...
@@ -31,10 +31,7 @@ import org.jkiss.utils.CommonUtils;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.Reader
;
import
java.io.*
;
import
java.util.Map
;
/**
...
...
@@ -164,24 +161,14 @@ public class DataExporterHTML extends StreamExporterAbstract {
private
void
writeTableTitle
(
String
value
,
int
columns
)
{
PrintWriter
out
=
getWriter
();
out
.
write
(
String
.
format
(
"<th colspan=\"%d\">"
,
columns
));
if
(
value
==
null
)
{
out
.
write
(
" "
);
}
else
{
value
=
value
.
replace
(
"&"
,
"&"
).
replace
(
"<"
,
"<"
).
replace
(
">"
,
">"
);
out
.
write
(
value
);
}
out
.
write
(
CommonUtils
.
escapeHtml
(
value
));
out
.
write
(
"</th>"
);
}
private
void
writeTextCell
(
String
value
,
boolean
header
)
{
PrintWriter
out
=
getWriter
();
out
.
write
(
header
?
"<th>"
:
"<td>"
);
if
(
value
==
null
)
{
out
.
write
(
" "
);
}
else
{
value
=
value
.
replace
(
"&"
,
"&"
).
replace
(
"<"
,
"<"
).
replace
(
">"
,
">"
);
out
.
write
(
value
);
}
out
.
write
(
CommonUtils
.
escapeHtml
(
value
));
out
.
write
(
header
?
"</th>"
:
"</td>"
);
}
...
...
@@ -228,33 +215,16 @@ public class DataExporterHTML extends StreamExporterAbstract {
}
private
void
writeCellValue
(
Reader
reader
)
throws
IOException
{
try
{
try
(
BufferedReader
bufferedReader
=
new
BufferedReader
(
reader
))
{
PrintWriter
out
=
getWriter
();
// Copy reader
char
[]
buffer
=
new
char
[
2000
];
for
(;
;
)
{
int
count
=
reader
.
read
(
buffer
);
if
(
count
<=
0
)
{
break
;
String
line
=
bufferedReader
.
readLine
();
while
(
line
!=
null
)
{
out
.
write
(
CommonUtils
.
escapeHtml
(
line
));
line
=
bufferedReader
.
readLine
(
);
if
(
line
!=
null
)
{
out
.
write
(
"<br>"
)
;
}
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
if
(
buffer
[
i
]
==
'<'
)
{
out
.
write
(
"<"
);
}
else
if
(
buffer
[
i
]
==
'>'
)
{
out
.
write
(
">"
);
}
if
(
buffer
[
i
]
==
'&'
)
{
out
.
write
(
"&"
);
}
out
.
write
(
buffer
[
i
]);
}
}
}
finally
{
ContentUtils
.
close
(
reader
);
}
}
public
boolean
saveBinariesAsImages
()
{
return
true
;
}
}
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSchema.java
浏览文件 @
bb262cd3
...
...
@@ -1084,11 +1084,11 @@ public class OracleSchema extends OracleGlobalObject implements DBSSchema, DBPRe
"i.OWNER,i.INDEX_NAME,i.INDEX_TYPE,i.TABLE_OWNER,i.TABLE_NAME,i.UNIQUENESS,i.TABLESPACE_NAME,i.STATUS,i.NUM_ROWS,i.SAMPLE_SIZE,\n"
+
"ic.COLUMN_NAME,ic.COLUMN_POSITION,ic.COLUMN_LENGTH,ic.DESCEND,iex.COLUMN_EXPRESSION\n"
+
"FROM "
+
OracleUtils
.
getAdminAllViewPrefix
(
session
.
getProgressMonitor
(),
getDataSource
(),
"INDEXES"
)
+
" i\n"
+
"
, "
+
OracleUtils
.
getAdminAllViewPrefix
(
session
.
getProgressMonitor
(),
getDataSource
(),
"IND_COLUMNS"
)
+
" ic,
"
+
OracleUtils
.
getAdminAllViewPrefix
(
session
.
getProgressMonitor
(),
getDataSource
(),
"IND_EXPRESSIONS"
)
+
" iex
"
+
"
WHERE ic.INDEX_OWNER=i.OWNER AND ic.INDEX_NAME=i.INDEX_NAME \n
"
+
"
AND iex.INDEX_OWNER(+)=i.OWNER AND iex.INDEX_NAME(+)=i.INDEX_NAME AND iex.COLUMN_POSITION(+)=
ic.COLUMN_POSITION\n"
+
"
AND
"
);
"
JOIN "
+
OracleUtils
.
getAdminAllViewPrefix
(
session
.
getProgressMonitor
(),
getDataSource
(),
"IND_COLUMNS"
)
+
" ic
"
+
"ON i.owner = ic.index_owner AND i.index_name = ic.index_name\n
"
+
"
LEFT JOIN "
+
OracleUtils
.
getAdminAllViewPrefix
(
session
.
getProgressMonitor
(),
getDataSource
(),
"IND_EXPRESSIONS"
)
+
" iex
"
+
"
ON iex.index_owner = i.owner AND iex.INDEX_NAME = i.INDEX_NAME AND iex.COLUMN_POSITION =
ic.COLUMN_POSITION\n"
+
"
WHERE
"
);
if
(
forTable
==
null
)
{
sql
.
append
(
"i.OWNER=?"
);
}
else
{
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleStructureAssistant.java
浏览文件 @
bb262cd3
...
...
@@ -157,9 +157,9 @@ public class OracleStructureAssistant implements DBSStructureAssistant<OracleExe
try
(
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
"SELECT "
+
OracleUtils
.
getSysCatalogHint
((
OracleDataSource
)
session
.
getDataSource
())
+
" OWNER, TABLE_NAME, CONSTRAINT_NAME, CONSTRAINT_TYPE\n"
+
"FROM "
+
OracleUtils
.
getAdminAllViewPrefix
(
monitor
,
(
OracleDataSource
)
session
.
getDataSource
(),
"CONSTRAINTS"
)
+
"\n"
+
"WHERE
CONSTRAINT_NAME like ?"
+
(!
hasFK
?
" AND CONSTRAINT_TYPE<>'R'"
:
"
"
)
+
(
schema
!=
null
?
" AND OWNER=?"
:
""
)))
{
dbStat
.
setString
(
1
,
params
.
getMask
().
toUpperCase
());
"WHERE
"
+
(
params
.
isCaseSensitive
()
?
" CONSTRAINT_NAME "
:
" UPPER(CONSTRAINT_NAME)
"
)
+
"LIKE ?"
+
(!
hasFK
?
" AND CONSTRAINT_TYPE<>'R'"
:
""
)
+
(
schema
!=
null
?
" AND OWNER=?"
:
""
)))
{
dbStat
.
setString
(
1
,
params
.
isCaseSensitive
()
?
params
.
getMask
()
:
params
.
getMask
().
toUpperCase
());
if
(
schema
!=
null
)
{
dbStat
.
setString
(
2
,
schema
.
getName
());
}
...
...
@@ -250,13 +250,25 @@ public class OracleStructureAssistant implements DBSStructureAssistant<OracleExe
if
(
searchViewsByDefinition
)
{
query
.
append
(
" UNION ALL SELECT OWNER, VIEW_NAME, 'VIEW' AS OBJECT_TYPE FROM "
);
query
.
append
(
OracleUtils
.
getAdminAllViewPrefix
(
session
.
getProgressMonitor
(),
dataSource
,
"VIEWS"
));
query
.
append
(
" v WHERE v.\"TEXT_VC\" LIKE ?"
);
query
.
append
(
" v WHERE "
);
if
(
params
.
isCaseSensitive
())
{
query
.
append
(
"v.\"TEXT_VC\""
);
}
else
{
query
.
append
(
"UPPER(v.\"TEXT_VC\")"
);
}
query
.
append
(
" LIKE ?"
);
query
.
append
(
ownerClause
);
}
if
(
params
.
isSearchInDefinitions
())
{
query
.
append
(
" UNION ALL SELECT DISTINCT owner, name, type FROM "
);
query
.
append
(
OracleUtils
.
getAdminAllViewPrefix
(
session
.
getProgressMonitor
(),
dataSource
,
"SOURCE"
));
query
.
append
(
" WHERE text LIKE ?"
);
query
.
append
(
" WHERE "
);
if
(
params
.
isCaseSensitive
())
{
query
.
append
(
"text "
);
}
else
{
query
.
append
(
"UPPER(text) "
);
}
query
.
append
(
"LIKE ?"
);
query
.
append
(
ownerClause
);
}
query
.
append
(
")\nORDER BY OBJECT_NAME"
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
浏览文件 @
bb262cd3
...
...
@@ -176,7 +176,7 @@ public final class SQLUtils {
else
if
(
c
==
'\\'
)
{
if
(
i
<
like
.
length
()
-
1
)
{
char
nc
=
like
.
charAt
(
i
+
1
);
if
(
nc
==
'_'
||
nc
==
'*'
||
nc
==
'?'
||
nc
==
'.'
)
{
if
(
nc
==
'_'
||
nc
==
'*'
||
nc
==
'?'
||
nc
==
'.'
||
nc
==
'%'
)
{
result
.
append
(
"\\"
).
append
(
nc
);
i
++;
}
else
{
...
...
test/org.jkiss.dbeaver.test.platform/src/org/jkiss/dbeaver/model/sql/format/tokenized/SQLFormatterTokenizedTest.java
浏览文件 @
bb262cd3
...
...
@@ -421,7 +421,7 @@ public class SQLFormatterTokenizedTest {
"\t1 = 1;"
;
//$NON-NLS-1$
assertEquals
(
"SQLFormatterTokenized does not properly format query with a comment between FROM and WHERE"
,
expected
,
format
(
sql
));
sql
=
SQLConstants
.
KEYWORD_SELECT
+
lineBreak
+
"\t--c
m
nt"
+
lineBreak
+
"a, b FROM a ;"
;
sql
=
SQLConstants
.
KEYWORD_SELECT
+
lineBreak
+
"\t--c
omme
nt"
+
lineBreak
+
"a, b FROM a ;"
;
expected
=
SQLConstants
.
KEYWORD_SELECT
+
lineBreak
+
"\t--comment"
+
lineBreak
+
"\ta,"
+
lineBreak
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录