Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
a884c3e9
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,发现更多精彩内容 >>
提交
a884c3e9
编写于
6月 12, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3575 PG: procedure parameter default value read
Former-commit-id:
6e77a9db
上级
10b364f9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
4 deletion
+44
-4
plugins/org.jkiss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
...ss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
+2
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreProcedure.java
.../jkiss/dbeaver/ext/postgresql/model/PostgreProcedure.java
+31
-3
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreProcedureParameter.java
...eaver/ext/postgresql/model/PostgreProcedureParameter.java
+10
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
...org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
+1
-1
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql/OSGI-INF/l10n/bundle.properties
浏览文件 @
a884c3e9
...
@@ -292,6 +292,8 @@ meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.parameterK
...
@@ -292,6 +292,8 @@ meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.parameterK
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.parameterKind.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.parameterKind.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.parameterType.name
=
Parameter Type
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.parameterType.name
=
Parameter Type
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.parameterType.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.parameterType.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.defaultValue.name
=
Default
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedureParameter.defaultValue.description
=
Parameter default value
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema.dataTypes.name
=
Data Types
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema.dataTypes.name
=
Data Types
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema.dataTypes.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema.dataTypes.description
=
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema.database.name
=
Database
meta.org.jkiss.dbeaver.ext.postgresql.model.PostgreSchema.database.name
=
Database
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreProcedure.java
浏览文件 @
a884c3e9
...
@@ -24,6 +24,7 @@ import org.jkiss.dbeaver.ext.postgresql.PostgreConstants;
...
@@ -24,6 +24,7 @@ import org.jkiss.dbeaver.ext.postgresql.PostgreConstants;
import
org.jkiss.dbeaver.ext.postgresql.PostgreUtils
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreUtils
;
import
org.jkiss.dbeaver.model.*
;
import
org.jkiss.dbeaver.model.*
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
import
org.jkiss.dbeaver.model.impl.struct.AbstractProcedure
;
import
org.jkiss.dbeaver.model.impl.struct.AbstractProcedure
;
...
@@ -92,7 +93,6 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
...
@@ -92,7 +93,6 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
private
boolean
returnsSet
;
private
boolean
returnsSet
;
private
ProcedureVolatile
procVolatile
;
private
ProcedureVolatile
procVolatile
;
private
PostgreDataType
returnType
;
private
PostgreDataType
returnType
;
private
Object
[]
argDefaults
;
private
int
[]
transformTypes
;
private
int
[]
transformTypes
;
private
String
[]
config
;
private
String
[]
config
;
private
Object
acl
;
private
Object
acl
;
...
@@ -143,17 +143,19 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
...
@@ -143,17 +143,19 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
log
.
debug
(
e
);
log
.
debug
(
e
);
}
}
}
}
DBSProcedureParameterKind
parameterKind
=
mode
==
null
?
DBSProcedureParameterKind
.
IN
:
mode
.
getParameterKind
();
PostgreProcedureParameter
param
=
new
PostgreProcedureParameter
(
PostgreProcedureParameter
param
=
new
PostgreProcedureParameter
(
this
,
this
,
paramName
,
paramName
,
dataType
,
dataType
,
mode
==
null
?
DBSProcedureParameterKind
.
IN
:
mode
.
getParameterKind
()
,
parameterKind
,
i
+
1
);
i
+
1
);
params
.
add
(
param
);
params
.
add
(
param
);
}
}
}
else
{
}
else
{
long
[]
inArgTypes
=
PostgreUtils
.
getIdVector
(
JDBCUtils
.
safeGetObject
(
dbResult
,
"proargtypes"
));
long
[]
inArgTypes
=
PostgreUtils
.
getIdVector
(
JDBCUtils
.
safeGetObject
(
dbResult
,
"proargtypes"
));
if
(!
ArrayUtils
.
isEmpty
(
inArgTypes
))
{
if
(!
ArrayUtils
.
isEmpty
(
inArgTypes
))
{
for
(
int
i
=
0
;
i
<
inArgTypes
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
inArgTypes
.
length
;
i
++)
{
Long
paramType
=
inArgTypes
[
i
];
Long
paramType
=
inArgTypes
[
i
];
...
@@ -165,12 +167,38 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
...
@@ -165,12 +167,38 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
//String paramName = argNames == null || argNames.length < inArg
//String paramName = argNames == null || argNames.length < inArg
//String paramName = "$" + (i + 1);
//String paramName = "$" + (i + 1);
String
paramName
=
argNames
==
null
||
argNames
.
length
<
inArgTypes
.
length
?
"$"
+
(
i
+
1
)
:
argNames
[
i
];
String
paramName
=
argNames
==
null
||
argNames
.
length
<
inArgTypes
.
length
?
"$"
+
(
i
+
1
)
:
argNames
[
i
];
PostgreProcedureParameter
param
=
new
PostgreProcedureParameter
(
this
,
paramName
,
dataType
,
DBSProcedureParameterKind
.
IN
,
i
+
1
);
PostgreProcedureParameter
param
=
new
PostgreProcedureParameter
(
this
,
paramName
,
dataType
,
DBSProcedureParameterKind
.
IN
,
i
+
1
);
params
.
add
(
param
);
params
.
add
(
param
);
}
}
}
}
}
}
try
{
String
argDefaultsString
=
JDBCUtils
.
safeGetString
(
dbResult
,
"arg_defaults"
);
String
[]
argDefaults
=
null
;
if
(!
CommonUtils
.
isEmpty
(
argDefaultsString
))
{
try
{
argDefaults
=
PostgreUtils
.
parseObjectString
(
argDefaultsString
);
}
catch
(
DBCException
e
)
{
log
.
debug
(
"Error parsing function parameters defaults"
,
e
);
}
}
if
(
argDefaults
!=
null
&&
argDefaults
.
length
>
0
)
{
// Assign defaults to last X arguments
int
paramsAssigned
=
0
;
for
(
int
i
=
params
.
size
()
-
1
;
i
>=
0
;
i
--)
{
params
.
get
(
i
).
setDefaultValue
(
argDefaults
[
argDefaults
.
length
-
1
-
paramsAssigned
]);
paramsAssigned
++;
if
(
paramsAssigned
>=
argDefaults
.
length
)
{
break
;
}
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"Error parsing parameters defaults"
,
e
);
}
this
.
overloadedName
=
makeOverloadedName
(
false
);
this
.
overloadedName
=
makeOverloadedName
(
false
);
{
{
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreProcedureParameter.java
浏览文件 @
a884c3e9
...
@@ -35,6 +35,7 @@ public class PostgreProcedureParameter implements DBSProcedureParameter, DBSAttr
...
@@ -35,6 +35,7 @@ public class PostgreProcedureParameter implements DBSProcedureParameter, DBSAttr
private
int
ordinalPosition
;
private
int
ordinalPosition
;
private
PostgreDataType
dataType
;
private
PostgreDataType
dataType
;
private
DBSProcedureParameterKind
parameterKind
;
private
DBSProcedureParameterKind
parameterKind
;
private
String
defaultValue
;
public
PostgreProcedureParameter
(
public
PostgreProcedureParameter
(
PostgreProcedure
procedure
,
PostgreProcedure
procedure
,
...
@@ -146,4 +147,13 @@ public class PostgreProcedureParameter implements DBSProcedureParameter, DBSAttr
...
@@ -146,4 +147,13 @@ public class PostgreProcedureParameter implements DBSProcedureParameter, DBSAttr
public
long
getMaxLength
()
{
public
long
getMaxLength
()
{
return
dataType
.
getMaxLength
();
return
dataType
.
getMaxLength
();
}
}
@Property
(
viewable
=
true
,
order
=
5
)
public
String
getDefaultValue
()
{
return
defaultValue
;
}
public
void
setDefaultValue
(
String
defaultValue
)
{
this
.
defaultValue
=
defaultValue
;
}
}
}
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
浏览文件 @
a884c3e9
...
@@ -786,7 +786,7 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
...
@@ -786,7 +786,7 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
@Override
@Override
public
JDBCStatement
prepareLookupStatement
(
@NotNull
JDBCSession
session
,
@NotNull
PostgreSchema
owner
,
@Nullable
PostgreProcedure
object
,
@Nullable
String
objectName
)
throws
SQLException
{
public
JDBCStatement
prepareLookupStatement
(
@NotNull
JDBCSession
session
,
@NotNull
PostgreSchema
owner
,
@Nullable
PostgreProcedure
object
,
@Nullable
String
objectName
)
throws
SQLException
{
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
"SELECT p.oid,p.*,d.description\n"
+
"SELECT p.oid,p.*,
pg_catalog.pg_get_expr(p.proargdefaults, 0) as arg_defaults,
d.description\n"
+
"FROM pg_catalog.pg_proc p\n"
+
"FROM pg_catalog.pg_proc p\n"
+
"LEFT OUTER JOIN pg_catalog.pg_description d ON d.objoid=p.oid\n"
+
"LEFT OUTER JOIN pg_catalog.pg_description d ON d.objoid=p.oid\n"
+
"WHERE p.pronamespace=?"
+
"WHERE p.pronamespace=?"
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录