Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
2c82f14b
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,发现更多精彩内容 >>
提交
2c82f14b
编写于
10月 19, 2021
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/devel' into devel
上级
c3695728
fb62c59b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
51 deletion
+63
-51
plugins/org.jkiss.dbeaver.ext.generic/plugin.xml
plugins/org.jkiss.dbeaver.ext.generic/plugin.xml
+1
-1
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
...rg/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
+48
-44
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericDataTypeCache.java
...jkiss/dbeaver/ext/generic/model/GenericDataTypeCache.java
+11
-4
plugins/org.jkiss.dbeaver.ext.hana/src/org/jkiss/dbeaver/ext/hana/model/HANASQLDialect.java
.../src/org/jkiss/dbeaver/ext/hana/model/HANASQLDialect.java
+3
-2
未找到文件。
plugins/org.jkiss.dbeaver.ext.generic/plugin.xml
浏览文件 @
2c82f14b
...
...
@@ -966,7 +966,7 @@
<file
type=
"jar"
path=
"https://ftp.cubrid.org/CUBRID_Drivers/JDBC_Driver/JDBC-10.1.0.7663-cubrid.jar"
/>
</driver>
<!-- Solr -->
`
<!-- Solr -->
<driver
id=
"apache_solrj"
label=
"Solr"
...
...
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
浏览文件 @
2c82f14b
...
...
@@ -67,6 +67,7 @@ public class GenericDataSource extends JDBCDataSource implements DBPTermProvider
private
List
<
GenericSchema
>
schemas
;
private
final
GenericMetaModel
metaModel
;
private
GenericObjectContainer
structureContainer
;
boolean
catalogsFiltered
;
private
String
queryGetActiveDB
;
private
String
querySetActiveDB
;
...
...
@@ -486,55 +487,13 @@ public class GenericDataSource extends JDBCDataSource implements DBPTermProvider
try
(
JDBCSession
session
=
DBUtils
.
openMetaSession
(
monitor
,
this
,
"Read generic metadata"
))
{
// Read metadata
JDBCDatabaseMetaData
metaData
=
session
.
getMetaData
();
boolean
catalogsFiltered
=
false
;
if
(!
omitCatalog
)
{
// Read catalogs
monitor
.
subTask
(
"Extract catalogs"
);
monitor
.
worked
(
1
);
final
GenericMetaObject
catalogObject
=
getMetaObject
(
GenericConstants
.
OBJECT_CATALOG
);
final
DBSObjectFilter
catalogFilters
=
getContainer
().
getObjectFilter
(
GenericCatalog
.
class
,
null
,
false
);
final
List
<
String
>
catalogNames
=
new
ArrayList
<>();
try
{
try
(
JDBCResultSet
dbResult
=
metaData
.
getCatalogs
())
{
int
totalCatalogs
=
0
;
while
(
dbResult
.
next
())
{
String
catalogName
=
GenericUtils
.
safeGetString
(
catalogObject
,
dbResult
,
JDBCConstants
.
TABLE_CAT
);
if
(
CommonUtils
.
isEmpty
(
catalogName
))
{
// Some drivers uses TABLE_QUALIFIER instead of catalog
catalogName
=
GenericUtils
.
safeGetStringTrimmed
(
catalogObject
,
dbResult
,
JDBCConstants
.
TABLE_QUALIFIER
);
if
(
CommonUtils
.
isEmpty
(
catalogName
))
{
continue
;
}
}
totalCatalogs
++;
if
(
catalogFilters
==
null
||
catalogFilters
.
matches
(
catalogName
))
{
catalogNames
.
add
(
catalogName
);
monitor
.
subTask
(
"Extract catalogs - "
+
catalogName
);
}
else
{
catalogsFiltered
=
true
;
}
if
(
monitor
.
isCanceled
())
{
break
;
}
}
if
(
totalCatalogs
==
1
&&
omitSingleCatalog
)
{
// Just one catalog. Looks like DB2 or PostgreSQL
// Let's just skip it and use only schemas
// It's ok to use "%" instead of catalog name anyway
catalogNames
.
clear
();
}
}
}
catch
(
UnsupportedOperationException
|
SQLFeatureNotSupportedException
e
)
{
// Just skip it
log
.
debug
(
"Catalog list not supported: "
+
e
.
getMessage
());
}
catch
(
Throwable
e
)
{
if
(
metaModel
.
isCatalogsOptional
())
{
// Error reading catalogs - just warn about it
log
.
warn
(
"Can't read catalog list"
,
e
);
}
else
{
throw
new
DBException
(
"Error reading catalog list"
,
e
);
}
}
final
List
<
String
>
catalogNames
=
getCatalogsNames
(
monitor
,
metaData
,
catalogObject
,
catalogFilters
);
if
(!
catalogNames
.
isEmpty
()
||
catalogsFiltered
)
{
this
.
catalogs
=
new
ArrayList
<>();
for
(
String
catalogName
:
catalogNames
)
{
...
...
@@ -543,7 +502,6 @@ public class GenericDataSource extends JDBCDataSource implements DBPTermProvider
}
}
}
if
(
CommonUtils
.
isEmpty
(
catalogs
)
&&
!
catalogsFiltered
)
{
// Catalogs not supported - try to read root schemas
monitor
.
subTask
(
"Extract schemas"
);
...
...
@@ -577,6 +535,52 @@ public class GenericDataSource extends JDBCDataSource implements DBPTermProvider
}
}
public
List
<
String
>
getCatalogsNames
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
JDBCDatabaseMetaData
metaData
,
GenericMetaObject
catalogObject
,
@Nullable
DBSObjectFilter
catalogFilters
)
throws
DBException
{
final
List
<
String
>
catalogNames
=
new
ArrayList
<>();
try
{
try
(
JDBCResultSet
dbResult
=
metaData
.
getCatalogs
())
{
int
totalCatalogs
=
0
;
while
(
dbResult
.
next
())
{
String
catalogName
=
GenericUtils
.
safeGetString
(
catalogObject
,
dbResult
,
JDBCConstants
.
TABLE_CAT
);
if
(
CommonUtils
.
isEmpty
(
catalogName
))
{
// Some drivers uses TABLE_QUALIFIER instead of catalog
catalogName
=
GenericUtils
.
safeGetStringTrimmed
(
catalogObject
,
dbResult
,
JDBCConstants
.
TABLE_QUALIFIER
);
if
(
CommonUtils
.
isEmpty
(
catalogName
))
{
continue
;
}
}
totalCatalogs
++;
if
(
catalogFilters
==
null
||
catalogFilters
.
matches
(
catalogName
))
{
catalogNames
.
add
(
catalogName
);
monitor
.
subTask
(
"Extract catalogs - "
+
catalogName
);
}
else
{
catalogsFiltered
=
true
;
}
if
(
monitor
.
isCanceled
())
{
break
;
}
}
if
(
totalCatalogs
==
1
&&
omitSingleCatalog
)
{
// Just one catalog. Looks like DB2 or PostgreSQL
// Let's just skip it and use only schemas
// It's ok to use "%" instead of catalog name anyway
catalogNames
.
clear
();
}
}
}
catch
(
UnsupportedOperationException
|
SQLFeatureNotSupportedException
e
)
{
// Just skip it
log
.
debug
(
"Catalog list not supported: "
+
e
.
getMessage
());
}
catch
(
Throwable
e
)
{
if
(
metaModel
.
isCatalogsOptional
())
{
// Error reading catalogs - just warn about it
log
.
warn
(
"Can't read catalog list"
,
e
);
}
else
{
throw
new
DBException
(
"Error reading catalog list"
,
e
);
}
}
return
catalogNames
;
}
public
boolean
isOmitCatalog
()
{
return
CommonUtils
.
getBoolean
(
getContainer
().
getDriver
().
getDriverParameter
(
GenericConstants
.
PARAM_OMIT_CATALOG
),
false
);
}
...
...
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericDataTypeCache.java
浏览文件 @
2c82f14b
...
...
@@ -28,13 +28,20 @@ import org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCBasicDataTypeCache;
public
class
GenericDataTypeCache
extends
JDBCBasicDataTypeCache
<
GenericStructContainer
,
GenericDataType
>
{
private
static
final
boolean
IGNORE_NUMERIC_TYPES
=
false
;
public
GenericDataTypeCache
(
GenericStructContainer
owner
)
{
super
(
owner
);
// Ignore abstract types. There can be multiple numeric types with the same name
// but different scale/precision properties
ignoredTypes
.
add
(
"NUMBER"
);
ignoredTypes
.
add
(
"NUMERIC"
);
if
(
IGNORE_NUMERIC_TYPES
)
{
// The code below was added for a long time ago. Perhaps it is still relevant for some databases.
// But there are databases like Netezza or Snowflake, which actually contain such data types as NUMBER and NUMERIC.
// Ignore abstract types. There can be multiple numeric types with the same name
// but different scale/precision properties
ignoredTypes
.
add
(
"NUMBER"
);
ignoredTypes
.
add
(
"NUMERIC"
);
}
}
@NotNull
...
...
plugins/org.jkiss.dbeaver.ext.hana/src/org/jkiss/dbeaver/ext/hana/model/HANASQLDialect.java
浏览文件 @
2c82f14b
...
...
@@ -47,9 +47,10 @@ public class HANASQLDialect extends GenericSQLDialect implements TPRuleProvider
private
static
final
String
[][]
HANA_BEGIN_END_BLOCK
=
new
String
[][]{
{
SQLConstants
.
BLOCK_BEGIN
,
SQLConstants
.
BLOCK_END
},
{
"IF"
,
SQLConstants
.
BLOCK_END
},
{
"IF"
,
SQLConstants
.
BLOCK_END
+
" IF"
},
{
SQLConstants
.
KEYWORD_CASE
,
SQLConstants
.
BLOCK_END
},
{
"FOR"
,
SQLConstants
.
BLOCK_END
+
" FOR"
}
{
"FOR"
,
SQLConstants
.
BLOCK_END
+
" FOR"
},
{
"WHILE"
,
SQLConstants
.
BLOCK_END
+
" WHILE"
}
};
public
HANASQLDialect
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录