Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
见谅
dbeaver
提交
867d1fc7
D
dbeaver
项目概览
见谅
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
6
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,发现更多精彩内容 >>
提交
867d1fc7
编写于
9月 07, 2014
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Postgre simple proc source
上级
b3c52838
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
86 addition
and
2 deletion
+86
-2
plugins/org.jkiss.dbeaver.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
...rg/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
+1
-1
plugins/org.jkiss.dbeaver.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaModel.java
...kiss/dbeaver/ext/generic/model/meta/GenericMetaModel.java
+5
-0
plugins/org.jkiss.dbeaver.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreDataTypeCache.java
...ss/dbeaver/ext/postgresql/model/PostgreDataTypeCache.java
+71
-0
plugins/org.jkiss.dbeaver.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreMetaModel.java
.../jkiss/dbeaver/ext/postgresql/model/PostgreMetaModel.java
+9
-1
未找到文件。
plugins/org.jkiss.dbeaver.generic/src/org/jkiss/dbeaver/ext/generic/model/GenericDataSource.java
浏览文件 @
867d1fc7
...
...
@@ -82,7 +82,7 @@ public class GenericDataSource extends JDBCDataSource
super
(
monitor
,
container
);
this
.
metaModel
=
metaModel
;
final
DBPDriver
driver
=
container
.
getDriver
();
this
.
dataTypeCache
=
new
JDBCBasic
DataTypeCache
(
container
);
this
.
dataTypeCache
=
metaModel
.
create
DataTypeCache
(
container
);
this
.
tableTypeCache
=
new
TableTypeCache
();
this
.
queryGetActiveDB
=
CommonUtils
.
toString
(
driver
.
getDriverParameter
(
GenericConstants
.
PARAM_QUERY_GET_ACTIVE_DB
));
this
.
querySetActiveDB
=
CommonUtils
.
toString
(
driver
.
getDriverParameter
(
GenericConstants
.
PARAM_QUERY_SET_ACTIVE_DB
));
...
...
plugins/org.jkiss.dbeaver.generic/src/org/jkiss/dbeaver/ext/generic/model/meta/GenericMetaModel.java
浏览文件 @
867d1fc7
...
...
@@ -26,7 +26,9 @@ import org.jkiss.dbeaver.model.exec.DBCExecutionPurpose;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCConstants
;
import
org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCBasicDataTypeCache
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSDataSourceContainer
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSProcedureType
;
import
org.jkiss.dbeaver.registry.RegistryConstants
;
import
org.jkiss.utils.ArrayUtils
;
...
...
@@ -170,4 +172,7 @@ public class GenericMetaModel {
return
""
;
}
public
JDBCBasicDataTypeCache
createDataTypeCache
(
DBSDataSourceContainer
container
)
{
return
new
JDBCBasicDataTypeCache
(
container
);
}
}
plugins/org.jkiss.dbeaver.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreDataTypeCache.java
0 → 100644
浏览文件 @
867d1fc7
/*
* Copyright (C) 2010-2014 Serge Rieder
* serge@jkiss.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package
org.jkiss.dbeaver.ext.postgresql.model
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCConstants
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
import
org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCBasicDataTypeCache
;
import
org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCDataType
;
import
org.jkiss.dbeaver.model.struct.DBSDataSourceContainer
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
/**
* PostgreMetaModel
*/
public
class
PostgreDataTypeCache
extends
JDBCBasicDataTypeCache
{
public
PostgreDataTypeCache
(
DBSDataSourceContainer
owner
)
{
super
(
owner
);
}
@Override
protected
JDBCStatement
prepareObjectsStatement
(
JDBCSession
session
,
JDBCDataSource
owner
)
throws
SQLException
{
return
session
.
prepareStatement
(
"SELECT t.oid,t.* FROM pg_catalog.pg_type ORDER by t.oid"
);
}
@Override
protected
JDBCDataType
fetchObject
(
JDBCSession
session
,
JDBCDataSource
owner
,
ResultSet
dbResult
)
throws
SQLException
,
DBException
{
int
typeId
=
JDBCUtils
.
safeGetInt
(
dbResult
,
"oid"
);
String
name
=
JDBCUtils
.
safeGetString
(
dbResult
,
"typename"
);
if
(
CommonUtils
.
isEmpty
(
name
))
{
return
null
;
}
return
new
JDBCDataType
(
owner
,
JDBCUtils
.
safeGetInt
(
dbResult
,
JDBCConstants
.
DATA_TYPE
),
name
,
JDBCUtils
.
safeGetString
(
dbResult
,
JDBCConstants
.
LOCAL_TYPE_NAME
),
JDBCUtils
.
safeGetBoolean
(
dbResult
,
JDBCConstants
.
UNSIGNED_ATTRIBUTE
),
JDBCUtils
.
safeGetInt
(
dbResult
,
JDBCConstants
.
SEARCHABLE
)
!=
0
,
JDBCUtils
.
safeGetInt
(
dbResult
,
JDBCConstants
.
PRECISION
),
JDBCUtils
.
safeGetInt
(
dbResult
,
JDBCConstants
.
MINIMUM_SCALE
),
JDBCUtils
.
safeGetInt
(
dbResult
,
JDBCConstants
.
MAXIMUM_SCALE
));
}
}
plugins/org.jkiss.dbeaver.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreMetaModel.java
浏览文件 @
867d1fc7
...
...
@@ -60,6 +60,14 @@ public class PostgreMetaModel extends GenericMetaModel
@Override
public
String
getProcedureDDL
(
DBRProgressMonitor
monitor
,
GenericProcedure
sourceObject
)
throws
DBException
{
return
super
.
getProcedureDDL
(
monitor
,
sourceObject
);
JDBCSession
session
=
sourceObject
.
getDataSource
().
openSession
(
monitor
,
DBCExecutionPurpose
.
META
,
"Read procedure definition"
);
try
{
return
JDBCUtils
.
queryString
(
session
,
"SELECT p.prosrc FROM PG_CATALOG.PG_PROC P, PG_CATALOG.PG_NAMESPACE NS\n"
+
"WHERE ns.oid=p.pronamespace and ns.nspname=? AND p.proname=?"
,
sourceObject
.
getContainer
().
getName
(),
sourceObject
.
getName
());
}
catch
(
SQLException
e
)
{
throw
new
DBException
(
e
,
sourceObject
.
getDataSource
());
}
finally
{
session
.
close
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录