Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
9bbc3df6
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,发现更多精彩内容 >>
提交
9bbc3df6
编写于
6月 14, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3621 HSQL synonyms support
Former-commit-id:
54ec79eb
上级
256fbd3f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
135 addition
and
5 deletion
+135
-5
plugins/org.jkiss.dbeaver.ext.generic/OSGI-INF/l10n/bundle.properties
...jkiss.dbeaver.ext.generic/OSGI-INF/l10n/bundle.properties
+2
-0
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
...rg/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
+6
-1
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericObjectContainer.java
...iss/dbeaver/ext/generic/model/GenericObjectContainer.java
+25
-2
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericSequence.java
.../org/jkiss/dbeaver/ext/generic/model/GenericSequence.java
+1
-1
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericStructContainer.java
...iss/dbeaver/ext/generic/model/GenericStructContainer.java
+2
-0
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericSynonym.java
...c/org/jkiss/dbeaver/ext/generic/model/GenericSynonym.java
+1
-1
plugins/org.jkiss.dbeaver.ext.hsqldb/OSGI-INF/l10n/bundle.properties
....jkiss.dbeaver.ext.hsqldb/OSGI-INF/l10n/bundle.properties
+2
-0
plugins/org.jkiss.dbeaver.ext.hsqldb/src/org/jkiss/dbeaver/ext/hsqldb/model/HSQLMetaModel.java
...src/org/jkiss/dbeaver/ext/hsqldb/model/HSQLMetaModel.java
+31
-0
plugins/org.jkiss.dbeaver.ext.hsqldb/src/org/jkiss/dbeaver/ext/hsqldb/model/HSQLSynonym.java
...b/src/org/jkiss/dbeaver/ext/hsqldb/model/HSQLSynonym.java
+65
-0
未找到文件。
plugins/org.jkiss.dbeaver.ext.generic/OSGI-INF/l10n/bundle.properties
浏览文件 @
9bbc3df6
...
...
@@ -79,6 +79,8 @@ meta.org.jkiss.dbeaver.ext.generic.model.GenericSequence.lastValue.name=Value
meta.org.jkiss.dbeaver.ext.generic.model.GenericSequence.minValue.name
=
Min Value
meta.org.jkiss.dbeaver.ext.generic.model.GenericSequence.maxValue.name
=
Max Value
meta.org.jkiss.dbeaver.ext.generic.model.GenericSequence.incrementBy.name
=
Increment
meta.org.jkiss.dbeaver.ext.generic.model.GenericSynonym.name.name
=
Name
meta.org.jkiss.dbeaver.ext.generic.model.GenericSynonym.description.name
=
Description
meta.org.jkiss.dbeaver.ext.generic.model.GenericTrigger.name.name
=
Name
meta.org.jkiss.dbeaver.ext.generic.model.GenericTrigger.description.name
=
Description
meta.org.jkiss.dbeaver.ext.generic.model.GenericTrigger.table.name
=
Table
...
...
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
浏览文件 @
9bbc3df6
...
...
@@ -356,10 +356,15 @@ public class GenericDataSource extends JDBCDataSource
}
@Override
public
Collection
<
GenericSequence
>
getSequences
(
DBRProgressMonitor
monitor
)
throws
DBException
{
public
Collection
<
?
extends
GenericSequence
>
getSequences
(
DBRProgressMonitor
monitor
)
throws
DBException
{
return
structureContainer
==
null
?
null
:
structureContainer
.
getSequences
(
monitor
);
}
@Override
public
Collection
<?
extends
GenericSynonym
>
getSynonyms
(
DBRProgressMonitor
monitor
)
throws
DBException
{
return
structureContainer
==
null
?
null
:
structureContainer
.
getSynonyms
(
monitor
);
}
@Override
public
Collection
<?
extends
GenericTrigger
>
getTriggers
(
DBRProgressMonitor
monitor
)
throws
DBException
{
return
structureContainer
==
null
?
null
:
structureContainer
.
getTriggers
(
monitor
);
...
...
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericObjectContainer.java
浏览文件 @
9bbc3df6
...
...
@@ -47,7 +47,8 @@ public abstract class GenericObjectContainer implements GenericStructContainer,D
private
final
PrimaryKeysCache
primaryKeysCache
;
private
List
<
GenericPackage
>
packages
;
protected
List
<
GenericProcedure
>
procedures
;
protected
List
<
GenericSequence
>
sequences
;
protected
List
<?
extends
GenericSequence
>
sequences
;
protected
List
<?
extends
GenericSynonym
>
synonyms
;
private
List
<?
extends
GenericTrigger
>
triggers
;
protected
GenericObjectContainer
(
@NotNull
GenericDataSource
dataSource
)
...
...
@@ -306,13 +307,21 @@ public abstract class GenericObjectContainer implements GenericStructContainer,D
}
@Override
public
Collection
<
GenericSequence
>
getSequences
(
DBRProgressMonitor
monitor
)
throws
DBException
{
public
Collection
<
?
extends
GenericSequence
>
getSequences
(
DBRProgressMonitor
monitor
)
throws
DBException
{
if
(
sequences
==
null
)
{
loadSequences
(
monitor
);
}
return
sequences
;
}
@Override
public
Collection
<?
extends
GenericSynonym
>
getSynonyms
(
DBRProgressMonitor
monitor
)
throws
DBException
{
if
(
synonyms
==
null
)
{
loadSynonyms
(
monitor
);
}
return
synonyms
;
}
@Override
public
Collection
<?
extends
GenericTrigger
>
getTriggers
(
DBRProgressMonitor
monitor
)
throws
DBException
{
if
(
triggers
==
null
)
{
...
...
@@ -363,6 +372,7 @@ public abstract class GenericObjectContainer implements GenericStructContainer,D
this
.
packages
=
null
;
this
.
procedures
=
null
;
this
.
sequences
=
null
;
this
.
synonyms
=
null
;
return
this
;
}
...
...
@@ -425,6 +435,19 @@ public abstract class GenericObjectContainer implements GenericStructContainer,D
}
}
private
synchronized
void
loadSynonyms
(
DBRProgressMonitor
monitor
)
throws
DBException
{
synonyms
=
dataSource
.
getMetaModel
().
loadSynonyms
(
monitor
,
this
);
// Order procedures
if
(
synonyms
==
null
)
{
synonyms
=
new
ArrayList
<>();
}
else
{
DBUtils
.
orderObjects
(
synonyms
);
}
}
private
synchronized
List
<?
extends
GenericTrigger
>
loadTriggers
(
DBRProgressMonitor
monitor
)
throws
DBException
{
...
...
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericSequence.java
浏览文件 @
9bbc3df6
...
...
@@ -76,7 +76,7 @@ public class GenericSequence implements DBSSequence, DBPQualifiedObject
@NotNull
@Override
public
DBP
DataSource
getDataSource
()
{
public
Generic
DataSource
getDataSource
()
{
return
container
.
getDataSource
();
}
...
...
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericStructContainer.java
浏览文件 @
9bbc3df6
...
...
@@ -70,6 +70,8 @@ public interface GenericStructContainer extends DBSObjectContainer, DBSProcedure
Collection
<?
extends
GenericSequence
>
getSequences
(
DBRProgressMonitor
monitor
)
throws
DBException
;
Collection
<?
extends
GenericSynonym
>
getSynonyms
(
DBRProgressMonitor
monitor
)
throws
DBException
;
Collection
<?
extends
GenericTrigger
>
getTriggers
(
DBRProgressMonitor
monitor
)
throws
DBException
;
Collection
<?
extends
GenericTrigger
>
getTableTriggers
(
DBRProgressMonitor
monitor
)
throws
DBException
;
...
...
plugins/org.jkiss.dbeaver.ext.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericSynonym.java
浏览文件 @
9bbc3df6
...
...
@@ -69,7 +69,7 @@ public abstract class GenericSynonym implements DBSAlias, DBSObject, DBPQualifie
@NotNull
@Override
public
DBP
DataSource
getDataSource
()
{
public
Generic
DataSource
getDataSource
()
{
return
container
.
getDataSource
();
}
...
...
plugins/org.jkiss.dbeaver.ext.hsqldb/OSGI-INF/l10n/bundle.properties
浏览文件 @
9bbc3df6
Bundle-Vendor
=
JKISS
Bundle-Name
=
DBeaver HSQLDB Support
meta.org.jkiss.dbeaver.ext.hsqldb.model.HSQLSynonym.targetObject.name
=
Object
meta.org.jkiss.dbeaver.ext.hsqldb.model.HSQLSynonym.targetObjectType.name
=
Object Type
meta.org.jkiss.dbeaver.ext.hsqldb.model.HSQLTrigger.orientation.name
=
Orientation
meta.org.jkiss.dbeaver.ext.hsqldb.model.HSQLTrigger.timing.name
=
Timing
meta.org.jkiss.dbeaver.ext.hsqldb.model.HSQLTrigger.manipulation.name
=
Manipulation
plugins/org.jkiss.dbeaver.ext.hsqldb/src/org/jkiss/dbeaver/ext/hsqldb/model/HSQLMetaModel.java
浏览文件 @
9bbc3df6
...
...
@@ -216,4 +216,35 @@ public class HSQLMetaModel extends GenericMetaModel
return
((
HSQLTrigger
)
trigger
).
getStatement
();
}
@Override
public
boolean
supportsSynonyms
(
GenericDataSource
dataSource
)
{
return
true
;
}
@Override
public
List
<
HSQLSynonym
>
loadSynonyms
(
DBRProgressMonitor
monitor
,
GenericStructContainer
container
)
throws
DBException
{
try
(
JDBCSession
session
=
DBUtils
.
openMetaSession
(
monitor
,
container
.
getDataSource
(),
"Read triggers"
))
{
try
(
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
"SELECT * FROM INFORMATION_SCHEMA.SYSTEM_SYNONYMS\n"
+
"WHERE SYNONYM_SCHEMA=?\n"
+
"ORDER BY SYNONYM_NAME"
))
{
dbStat
.
setString
(
1
,
container
.
getName
());
List
<
HSQLSynonym
>
result
=
new
ArrayList
<>();
try
(
JDBCResultSet
dbResult
=
dbStat
.
executeQuery
())
{
while
(
dbResult
.
next
())
{
HSQLSynonym
trigger
=
new
HSQLSynonym
(
container
,
dbResult
);
result
.
add
(
trigger
);
}
}
return
result
;
}
}
catch
(
SQLException
e
)
{
throw
new
DBException
(
e
,
container
.
getDataSource
());
}
}
}
plugins/org.jkiss.dbeaver.ext.hsqldb/src/org/jkiss/dbeaver/ext/hsqldb/model/HSQLSynonym.java
0 → 100644
浏览文件 @
9bbc3df6
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2018 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.hsqldb.model
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ext.generic.model.GenericSchema
;
import
org.jkiss.dbeaver.ext.generic.model.GenericStructContainer
;
import
org.jkiss.dbeaver.ext.generic.model.GenericSynonym
;
import
org.jkiss.dbeaver.ext.generic.model.GenericTable
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
import
org.jkiss.dbeaver.model.meta.Property
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
/**
* HSQLSynonym
*/
public
class
HSQLSynonym
extends
GenericSynonym
{
private
static
final
Log
log
=
Log
.
getLog
(
HSQLSynonym
.
class
);
private
String
targetSchemaName
;
private
String
targetObjectName
;
private
String
targetObjectType
;
protected
HSQLSynonym
(
GenericStructContainer
container
,
JDBCResultSet
dbResult
)
{
super
(
container
,
JDBCUtils
.
safeGetString
(
dbResult
,
"SYNONYM_NAME"
),
null
);
targetSchemaName
=
JDBCUtils
.
safeGetString
(
dbResult
,
"OBJECT_SCHEMA"
);
targetObjectName
=
JDBCUtils
.
safeGetString
(
dbResult
,
"OBJECT_NAME"
);
targetObjectType
=
JDBCUtils
.
safeGetString
(
dbResult
,
"OBJECT_TYPE"
);
}
@Property
(
viewable
=
true
,
order
=
3
)
public
String
getTargetObjectType
()
{
return
targetObjectType
;
}
@Property
(
viewable
=
true
,
order
=
4
)
@Override
public
DBSObject
getTargetObject
(
DBRProgressMonitor
monitor
)
throws
DBException
{
GenericSchema
schema
=
getDataSource
().
getSchema
(
targetSchemaName
);
if
(
schema
==
null
)
{
log
.
error
(
"Schema '"
+
targetSchemaName
+
"' not found"
);
}
else
{
return
schema
.
getTable
(
monitor
,
targetObjectName
);
}
return
null
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录