Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
54fcef3b
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,发现更多精彩内容 >>
提交
54fcef3b
编写于
12月 30, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#4824 PG: aggregate functions reading
Former-commit-id:
6b77071c
上级
2b98681d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
165 addition
and
0 deletion
+165
-0
plugins/org.jkiss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
...ss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
+12
-0
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
+3
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreAggregate.java
.../jkiss/dbeaver/ext/postgresql/model/PostgreAggregate.java
+120
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
...org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
+30
-0
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
浏览文件 @
54fcef3b
...
...
@@ -173,6 +173,16 @@ meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreExtension.schema.name=Schema
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreExtension.schema.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreExtension.version.name
=
Version
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreExtension.version.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.name.name
=
Name
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.name.description
=
Aggregate function name
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.inputTypes.name
=
Inputs
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.inputTypes.description
=
Input data types
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.outputType.name
=
Output type
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.outputType.description
=
Output data type
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.objectId.name
=
Object ID
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.objectId.description
=
Function object ID
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.function.name
=
Function
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate.function.description
=
Function definition
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreForeignDataWrapper.handler.name
=
Handler
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreForeignDataWrapper.handler.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreForeignDataWrapper.name.name
=
Name
...
...
@@ -565,6 +575,8 @@ tree.tview.node.name=View
tree.tviews.node.name
=
Views
tree.type.node.name
=
Data type
tree.types.node.name
=
Data types
tree.aggregates.node.name
=
Aggregate functions
tree.aggregate.node.name
=
Aggregate function
tree.role.node.name
=
Role
tree.roles.node.name
=
Roles
tree.role.member.node.name
=
Role
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
浏览文件 @
54fcef3b
...
...
@@ -147,6 +147,9 @@
</folder>
</items>
</folder>
<folder
type=
"org.jkiss.dbeaver.ext.postgresql.model.PostgreAggregate"
label=
"%tree.aggregates.node.name"
icon=
"#functions"
description=
"Aggregate functions"
>
<items
label=
"%tree.aggregate.node.name"
path=
"aggregate"
property=
"aggregateFunctions"
icon=
"#function"
/>
</folder>
<folder
type=
"org.jkiss.dbeaver.ext.postgresql.model.PostgreInformation"
label=
"%tree.information.node.name"
icon=
"#folder_info"
description=
"Information"
>
<folder
type=
"org.jkiss.dbeaver.ext.postgresql.model.PostgreCollation"
label=
"%tree.collations.node.name"
icon=
"#collations"
description=
"Collations"
visibleIf=
"object.dataSource.serverType.supportsCollations()"
>
<items
label=
"%tree.collation.node.name"
path=
"collation"
property=
"collations"
icon=
"#collation"
/>
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreAggregate.java
0 → 100644
浏览文件 @
54fcef3b
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 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.postgresql.model
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
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
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* PostgreAggregate
*/
public
class
PostgreAggregate
implements
PostgreObject
{
private
long
oid
;
private
PostgreSchema
schema
;
private
String
name
;
private
boolean
persisted
;
public
PostgreAggregate
(
PostgreSchema
schema
,
ResultSet
dbResult
)
throws
SQLException
{
this
.
schema
=
schema
;
this
.
loadInfo
(
dbResult
);
}
private
void
loadInfo
(
ResultSet
dbResult
)
throws
SQLException
{
this
.
oid
=
JDBCUtils
.
safeGetLong
(
dbResult
,
"proc_oid"
);
this
.
name
=
JDBCUtils
.
safeGetString
(
dbResult
,
"proc_name"
);
this
.
persisted
=
true
;
}
@NotNull
@Override
@Property
(
viewable
=
true
,
order
=
1
)
public
String
getName
()
{
return
name
;
}
@Property
(
viewable
=
true
,
order
=
2
)
public
List
<
PostgreDataType
>
getInputTypes
(
DBRProgressMonitor
monitor
)
throws
DBException
{
PostgreProcedure
function
=
getFunction
(
monitor
);
if
(
function
==
null
)
{
return
null
;
}
List
<
PostgreDataType
>
result
=
new
ArrayList
<>();
for
(
PostgreProcedureParameter
param
:
function
.
getInputParameters
())
{
result
.
add
(
param
.
getParameterType
());
}
return
result
;
}
@Property
(
viewable
=
true
,
order
=
3
)
public
PostgreDataType
getOutputType
(
DBRProgressMonitor
monitor
)
throws
DBException
{
PostgreProcedure
function
=
getFunction
(
monitor
);
return
function
==
null
?
null
:
function
.
getReturnType
();
}
@Property
(
viewable
=
false
,
order
=
80
)
@Override
public
long
getObjectId
()
{
return
oid
;
}
@Property
(
viewable
=
true
,
order
=
10
)
public
PostgreProcedure
getFunction
(
DBRProgressMonitor
monitor
)
throws
DBException
{
return
schema
.
getProcedure
(
monitor
,
this
.
oid
);
}
@Override
public
DBSObject
getParentObject
()
{
return
schema
;
}
@Override
public
PostgreDataSource
getDataSource
()
{
return
schema
.
getDataSource
();
}
@Override
public
PostgreDatabase
getDatabase
()
{
return
schema
.
getDatabase
();
}
@Override
public
String
getDescription
()
{
return
null
;
}
@Override
public
boolean
isPersisted
()
{
return
persisted
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
浏览文件 @
54fcef3b
...
...
@@ -70,6 +70,7 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
public
final
CollationCache
collationCache
=
new
CollationCache
();
public
final
ExtensionCache
extensionCache
=
new
ExtensionCache
();
public
final
AggregateCache
aggregateCache
=
new
AggregateCache
();
public
final
TableCache
tableCache
=
new
TableCache
();
public
final
ConstraintCache
constraintCache
=
new
ConstraintCache
();
public
final
ProceduresCache
proceduresCache
=
new
ProceduresCache
();
...
...
@@ -184,6 +185,12 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
return
extensionCache
.
getAllObjects
(
monitor
,
this
);
}
@Association
public
Collection
<
PostgreAggregate
>
getAggregateFunctions
(
DBRProgressMonitor
monitor
)
throws
DBException
{
return
aggregateCache
.
getAllObjects
(
monitor
,
this
);
}
@Association
public
Collection
<
PostgreIndex
>
getIndexes
(
DBRProgressMonitor
monitor
)
throws
DBException
{
...
...
@@ -411,6 +418,29 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
}
}
class
AggregateCache
extends
JDBCObjectCache
<
PostgreSchema
,
PostgreAggregate
>
{
@Override
protected
JDBCStatement
prepareObjectsStatement
(
@NotNull
JDBCSession
session
,
@NotNull
PostgreSchema
owner
)
throws
SQLException
{
final
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
"SELECT p.oid AS proc_oid,p.proname AS proc_name,a.*\n"
+
"FROM pg_catalog.pg_aggregate a,pg_catalog.pg_proc p\n"
+
"WHERE p.oid=a.aggfnoid AND p.pronamespace=?\n"
+
"ORDER BY p.proname"
);
dbStat
.
setLong
(
1
,
PostgreSchema
.
this
.
getObjectId
());
return
dbStat
;
}
@Override
protected
PostgreAggregate
fetchObject
(
@NotNull
JDBCSession
session
,
@NotNull
PostgreSchema
owner
,
@NotNull
JDBCResultSet
dbResult
)
throws
SQLException
,
DBException
{
return
new
PostgreAggregate
(
owner
,
dbResult
);
}
}
public
class
TableCache
extends
JDBCStructLookupCache
<
PostgreSchema
,
PostgreTableBase
,
PostgreTableColumn
>
{
protected
TableCache
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录