Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
476448cb
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,发现更多精彩内容 >>
提交
476448cb
编写于
1月 04, 2018
作者:
A
Andrew Khitrin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Variables, Code format, Session termination, Some details
上级
90858b4e
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
1807 addition
and
1383 deletion
+1807
-1383
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/Breakpoint.java
...rc/org/jkiss/dbeaver/ext/postgresql/pldbg/Breakpoint.java
+23
-4
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/BreakpointProperties.java
...ss/dbeaver/ext/postgresql/pldbg/BreakpointProperties.java
+17
-0
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/DebugException.java
...rg/jkiss/dbeaver/ext/postgresql/pldbg/DebugException.java
+10
-15
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/DebugObject.java
...c/org/jkiss/dbeaver/ext/postgresql/pldbg/DebugObject.java
+21
-3
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/DebugSession.java
.../org/jkiss/dbeaver/ext/postgresql/pldbg/DebugSession.java
+40
-9
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/SessionInfo.java
...c/org/jkiss/dbeaver/ext/postgresql/pldbg/SessionInfo.java
+18
-1
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/StackFrame.java
...rc/org/jkiss/dbeaver/ext/postgresql/pldbg/StackFrame.java
+20
-1
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/Variable.java
.../src/org/jkiss/dbeaver/ext/postgresql/pldbg/Variable.java
+23
-4
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/VariableType.java
.../org/jkiss/dbeaver/ext/postgresql/pldbg/VariableType.java
+20
-1
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/console/Debugger.java
.../jkiss/dbeaver/ext/postgresql/pldbg/console/Debugger.java
+617
-458
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/BreakpointPropertiesPostgres.java
...t/postgresql/pldbg/impl/BreakpointPropertiesPostgres.java
+72
-67
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugManagerPostgres.java
...eaver/ext/postgresql/pldbg/impl/DebugManagerPostgres.java
+135
-170
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugObjectPostgres.java
...beaver/ext/postgresql/pldbg/impl/DebugObjectPostgres.java
+49
-64
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugSessionPostgres.java
...eaver/ext/postgresql/pldbg/impl/DebugSessionPostgres.java
+404
-382
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugSessionResult.java
...dbeaver/ext/postgresql/pldbg/impl/DebugSessionResult.java
+35
-20
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugSessionWorker.java
...dbeaver/ext/postgresql/pldbg/impl/DebugSessionWorker.java
+43
-23
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/PostgresBreakpoint.java
...dbeaver/ext/postgresql/pldbg/impl/PostgresBreakpoint.java
+63
-59
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/PostgresStackFrame.java
...dbeaver/ext/postgresql/pldbg/impl/PostgresStackFrame.java
+52
-46
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/PostgresVariable.java
...s/dbeaver/ext/postgresql/pldbg/impl/PostgresVariable.java
+103
-0
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/SessionInfoPostgres.java
...beaver/ext/postgresql/pldbg/impl/SessionInfoPostgres.java
+42
-56
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/Breakpoint.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg
;
public
interface
Breakpoint
{
DebugObject
<?>
getObj
();
BreakpointProperties
getProperties
();
void
drop
()
throws
DebugException
;
DebugObject
<?>
getObj
();
BreakpointProperties
getProperties
();
void
drop
()
throws
DebugException
;
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/BreakpointProperties.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg
;
public
interface
BreakpointProperties
{
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/DebugException.java
浏览文件 @
476448cb
...
...
@@ -14,27 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.postgresql.pldbg
;
package
org.jkiss.dbeaver.ext.postgresql.pldbg
;
@SuppressWarnings
(
"serial"
)
public
class
DebugException
extends
Exception
{
public
DebugException
(
String
message
,
Throwable
e
)
{
super
(
message
,
e
);
}
public
DebugException
(
String
message
,
Throwable
e
)
{
super
(
message
,
e
);
}
public
DebugException
(
String
message
)
{
super
(
message
);
}
public
DebugException
(
String
message
)
{
super
(
message
);
}
public
DebugException
(
Throwable
e
)
{
super
(
e
);
}
public
DebugException
(
Throwable
e
)
{
super
(
e
);
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/DebugObject.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg
;
public
interface
DebugObject
<
OBJECTID
>
{
OBJECTID
getID
();
String
getName
();
OBJECTID
getID
();
String
getName
();
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/DebugSession.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg
;
import
java.sql.Connection
;
import
java.util.List
;
public
interface
DebugSession
<
SESSIONINFO
extends
SessionInfo
<?>,
DEBUGOBJECT
extends
DebugObject
<?>,
SESSIONID
>
{
public
interface
DebugSession
<
SESSIONINFO
extends
SessionInfo
<?>,
DEBUGOBJECT
extends
DebugObject
<?>,
SESSIONID
>
{
SESSIONINFO
getSessionInfo
();
String
getTitle
();
List
<?
extends
Breakpoint
>
getBreakpoints
();
Breakpoint
setBreakpoint
(
DEBUGOBJECT
obj
,
BreakpointProperties
properties
)
throws
DebugException
;
void
removeBreakpoint
(
Breakpoint
bp
);
Breakpoint
setBreakpoint
(
DEBUGOBJECT
obj
,
BreakpointProperties
properties
)
throws
DebugException
;
void
removeBreakpoint
(
Breakpoint
bp
)
throws
DebugException
;
void
execContinue
()
throws
DebugException
;
void
execStepInto
()
throws
DebugException
;
void
execStepOver
()
throws
DebugException
;
void
abort
();
List
<?
extends
Variable
<?>>
getVarables
(
String
ctx
);
void
setVariableVal
(
Variable
<?>
variable
,
Object
value
);
List
<?
extends
StackFrame
>
getStack
()
throws
DebugException
;
void
abort
()
throws
DebugException
;
void
close
();
List
<?
extends
Variable
<?>>
getVarables
()
throws
DebugException
;
void
setVariableVal
(
Variable
<?>
variable
,
Object
value
)
throws
DebugException
;
List
<?
extends
StackFrame
>
getStack
()
throws
DebugException
;
SESSIONID
getSessionId
();
//move Stack
// move Stack
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/SessionInfo.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg
;
public
interface
SessionInfo
<
SESSIONID
>
{
SESSIONID
getID
();
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/StackFrame.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg
;
public
interface
StackFrame
{
String
getName
();
String
getName
();
int
getLevel
();
int
getLine
();
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/Variable.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg
;
public
interface
Variable
<
T
>
{
T
getVal
();
String
getName
();
VariableType
getType
();
T
getVal
();
String
getName
();
VariableType
getType
();
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/VariableType.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg
;
public
enum
VariableType
{
NUMBER
,
TEXT
,
DATE
,
BLOB
}
public
enum
VariableType
{
NUMBER
,
TEXT
,
DATE
,
BLOB
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/console/Debugger.java
浏览文件 @
476448cb
此差异已折叠。
点击以展开。
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/BreakpointPropertiesPostgres.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg.impl
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.BreakpointProperties
;
public
class
BreakpointPropertiesPostgres
implements
BreakpointProperties
{
private
final
long
lineNo
;
private
final
boolean
onStart
;
private
final
long
targetId
;
private
final
boolean
all
;
private
final
boolean
global
;
public
long
getLineNo
()
{
return
lineNo
;
}
public
boolean
isOnStart
()
{
return
onStart
;
}
public
long
getTargetId
()
{
return
targetId
;
}
public
boolean
isAll
()
{
return
all
;
}
private
final
long
lineNo
;
private
final
boolean
onStart
;
private
final
long
targetId
;
private
final
boolean
all
;
private
final
boolean
global
;
public
long
getLineNo
()
{
return
lineNo
;
}
public
boolean
isOnStart
()
{
return
onStart
;
}
public
long
getTargetId
()
{
return
targetId
;
}
public
boolean
isAll
()
{
return
all
;
}
public
boolean
isGlobal
()
{
return
global
;
}
public
BreakpointPropertiesPostgres
(
long
lineNo
,
long
targetId
,
boolean
global
)
{
this
.
lineNo
=
lineNo
;
this
.
onStart
=
lineNo
<
0
;
this
.
targetId
=
targetId
;
this
.
all
=
targetId
<
0
;
this
.
global
=
global
;
}
public
BreakpointPropertiesPostgres
(
long
lineNo
,
boolean
global
)
{
this
.
lineNo
=
lineNo
;
this
.
onStart
=
lineNo
<
0
;
this
.
targetId
=
-
1
;
this
.
all
=
true
;
this
.
global
=
global
;
}
public
BreakpointPropertiesPostgres
(
boolean
global
)
{
this
.
lineNo
=
-
1
;
this
.
onStart
=
true
;
this
.
targetId
=
-
1
;
this
.
all
=
true
;
this
.
global
=
global
;
}
@Override
public
String
toString
()
{
return
"BreakpointPropertiesPostgres [lineNo="
+
lineNo
+
", onStart="
+
onStart
+
", targetId="
+
targetId
+
", all="
+
all
+
", global="
+
global
+
"]"
;
}
public
boolean
isGlobal
()
{
return
global
;
}
public
BreakpointPropertiesPostgres
(
long
lineNo
,
long
targetId
,
boolean
global
)
{
this
.
lineNo
=
lineNo
;
this
.
onStart
=
lineNo
<
0
;
this
.
targetId
=
targetId
;
this
.
all
=
targetId
<
0
;
this
.
global
=
global
;
}
public
BreakpointPropertiesPostgres
(
long
lineNo
,
boolean
global
)
{
this
.
lineNo
=
lineNo
;
this
.
onStart
=
lineNo
<
0
;
this
.
targetId
=
-
1
;
this
.
all
=
true
;
this
.
global
=
global
;
}
public
BreakpointPropertiesPostgres
(
boolean
global
)
{
this
.
lineNo
=
-
1
;
this
.
onStart
=
true
;
this
.
targetId
=
-
1
;
this
.
all
=
true
;
this
.
global
=
global
;
}
@Override
public
String
toString
()
{
return
"BreakpointPropertiesPostgres [lineNo="
+
lineNo
+
", onStart="
+
onStart
+
", targetId="
+
targetId
+
", all="
+
all
+
", global="
+
global
+
"]"
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugManagerPostgres.java
浏览文件 @
476448cb
...
...
@@ -27,179 +27,144 @@ import java.util.List;
import
java.util.Map
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.DebugException
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.DebugObject
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.DebugSession
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.SessionInfo
;
import
org.jkiss.dbeaver.postgresql.pldbg.control.DebugManager
;
/**
* @author Andrey.Hitrin
*
*/
@SuppressWarnings
(
"nls"
)
public
class
DebugManagerPostgres
implements
DebugManager
<
Integer
,
Integer
>
{
private
final
Connection
connection
;
private
static
final
String
SQL_SESSION
=
"select pid,usename,application_name,state,query from pg_stat_activity"
;
private
static
final
String
SQL_OBJECT
=
"select p.oid,p.proname,u.usename as owner,n.nspname, l.lanname as lang "
+
" from "
+
" pg_catalog.pg_namespace n "
+
" join pg_catalog.pg_proc p on p.pronamespace = n.oid "
+
" join pg_user u on u.usesysid = p.proowner "
+
" join pg_language l on l.oid = p. prolang "
+
" where "
+
" l.lanname = 'plpgsql' "
+
" and p.proname like '%?nameCtx%' "
+
" and u.usename like '%?userCtx%' "
+
" order by "
+
" n.nspname,p.proname"
;
private
static
final
String
SQL_CURRENT_SESSION
=
"select pid,usename,application_name,state,query from pg_stat_activity where pid = pg_backend_pid()"
;
private
final
Map
<
Integer
,
DebugSessionPostgres
>
sessions
=
new
HashMap
<
Integer
,
DebugSessionPostgres
>(
1
);
@Override
public
SessionInfoPostgres
getSessionInfo
(
Connection
connectionTarget
)
throws
DebugException
{
try
(
Statement
stmt
=
connectionTarget
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_CURRENT_SESSION
);
if
(
rs
.
next
())
{
SessionInfoPostgres
res
=
new
SessionInfoPostgres
(
rs
.
getInt
(
"pid"
)
,
rs
.
getString
(
"usename"
),
rs
.
getString
(
"application_name"
),
rs
.
getString
(
"state"
),
rs
.
getString
(
"query"
));
return
res
;
}
throw
new
DebugException
(
"Error getting session"
);
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
@Override
public
List
<
SessionInfoPostgres
>
getSessions
()
throws
DebugException
{
try
(
Statement
stmt
=
connection
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_SESSION
);
List
<
SessionInfoPostgres
>
res
=
new
ArrayList
<
SessionInfoPostgres
>();
while
(
rs
.
next
())
{
res
.
add
(
new
SessionInfoPostgres
(
rs
.
getInt
(
"pid"
)
,
rs
.
getString
(
"usename"
),
rs
.
getString
(
"application_name"
),
rs
.
getString
(
"state"
),
rs
.
getString
(
"query"
)));
}
return
res
;
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
/**
* @param connection
*/
public
DebugManagerPostgres
(
Connection
connection
)
{
super
();
this
.
connection
=
connection
;
}
@Override
public
List
<
DebugObjectPostgres
>
getObjects
(
String
ownerCtx
,
String
nameCtx
)
throws
DebugException
{
try
(
Statement
stmt
=
connection
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_OBJECT
.
replaceAll
(
"\\?nameCtx"
,
nameCtx
).
replaceAll
(
"\\?userCtx"
,
ownerCtx
).
toLowerCase
());
List
<
DebugObjectPostgres
>
res
=
new
ArrayList
<
DebugObjectPostgres
>();
while
(
rs
.
next
())
{
res
.
add
(
new
DebugObjectPostgres
(
rs
.
getInt
(
"oid"
)
,
rs
.
getString
(
"proname"
),
rs
.
getString
(
"owner"
),
rs
.
getString
(
"nspname"
),
rs
.
getString
(
"lang"
)));
}
return
res
;
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
@Override
public
DebugSession
<
SessionInfoPostgres
,
DebugObjectPostgres
,
Integer
>
getDebugSession
(
Integer
id
)
throws
DebugException
{
return
sessions
.
get
(
id
);
}
@Override
public
DebugSessionPostgres
createDebugSession
(
Connection
connectionTarget
)
throws
DebugException
{
SessionInfoPostgres
targetInfo
=
getSessionInfo
(
connectionTarget
);
DebugSessionPostgres
debugSession
=
new
DebugSessionPostgres
(
getSessionInfo
(
this
.
connection
),
targetInfo
,
connectionTarget
);
sessions
.
put
(
targetInfo
.
getPid
(),
debugSession
);
return
debugSession
;
}
@Override
public
boolean
isSessionExists
(
Integer
id
)
{
return
sessions
.
containsKey
(
id
);
}
@Override
public
void
terminateSession
(
Integer
id
)
{
// TODO Auto-generated method stub
}
@Override
public
List
<
DebugSession
<?,?,
Integer
>>
getDebugSessions
()
throws
DebugException
{
return
new
ArrayList
<
DebugSession
<?,?,
Integer
>>(
sessions
.
values
());
}
public
class
DebugManagerPostgres
implements
DebugManager
<
Integer
,
Integer
>
{
private
final
Connection
connection
;
private
static
final
String
SQL_SESSION
=
"select pid,usename,application_name,state,query from pg_stat_activity"
;
private
static
final
String
SQL_OBJECT
=
"select p.oid,p.proname,u.usename as owner,n.nspname, l.lanname as lang "
+
" from "
+
" pg_catalog.pg_namespace n "
+
" join pg_catalog.pg_proc p on p.pronamespace = n.oid "
+
" join pg_user u on u.usesysid = p.proowner "
+
" join pg_language l on l.oid = p. prolang "
+
" where "
+
" l.lanname = 'plpgsql' "
+
" and p.proname like '%?nameCtx%' "
+
" and u.usename like '%?userCtx%' "
+
" order by "
+
" n.nspname,p.proname"
;
private
static
final
String
SQL_CURRENT_SESSION
=
"select pid,usename,application_name,state,query from pg_stat_activity where pid = pg_backend_pid()"
;
private
final
Map
<
Integer
,
DebugSessionPostgres
>
sessions
=
new
HashMap
<
Integer
,
DebugSessionPostgres
>(
1
);
@Override
public
SessionInfoPostgres
getSessionInfo
(
Connection
connectionTarget
)
throws
DebugException
{
try
(
Statement
stmt
=
connectionTarget
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_CURRENT_SESSION
);
if
(
rs
.
next
())
{
SessionInfoPostgres
res
=
new
SessionInfoPostgres
(
rs
.
getInt
(
"pid"
),
rs
.
getString
(
"usename"
),
rs
.
getString
(
"application_name"
),
rs
.
getString
(
"state"
),
rs
.
getString
(
"query"
));
return
res
;
}
throw
new
DebugException
(
"Error getting session"
);
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
@Override
public
List
<
SessionInfoPostgres
>
getSessions
()
throws
DebugException
{
try
(
Statement
stmt
=
connection
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_SESSION
);
List
<
SessionInfoPostgres
>
res
=
new
ArrayList
<
SessionInfoPostgres
>();
while
(
rs
.
next
())
{
res
.
add
(
new
SessionInfoPostgres
(
rs
.
getInt
(
"pid"
),
rs
.
getString
(
"usename"
),
rs
.
getString
(
"application_name"
),
rs
.
getString
(
"state"
),
rs
.
getString
(
"query"
)));
}
return
res
;
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
/**
* @param connection
*/
public
DebugManagerPostgres
(
Connection
connection
)
{
super
();
this
.
connection
=
connection
;
}
@Override
public
List
<
DebugObjectPostgres
>
getObjects
(
String
ownerCtx
,
String
nameCtx
)
throws
DebugException
{
try
(
Statement
stmt
=
connection
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_OBJECT
.
replaceAll
(
"\\?nameCtx"
,
nameCtx
).
replaceAll
(
"\\?userCtx"
,
ownerCtx
).
toLowerCase
());
List
<
DebugObjectPostgres
>
res
=
new
ArrayList
<
DebugObjectPostgres
>();
while
(
rs
.
next
())
{
res
.
add
(
new
DebugObjectPostgres
(
rs
.
getInt
(
"oid"
),
rs
.
getString
(
"proname"
),
rs
.
getString
(
"owner"
),
rs
.
getString
(
"nspname"
),
rs
.
getString
(
"lang"
)));
}
return
res
;
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
@Override
public
DebugSession
<
SessionInfoPostgres
,
DebugObjectPostgres
,
Integer
>
getDebugSession
(
Integer
id
)
throws
DebugException
{
return
sessions
.
get
(
id
);
}
@Override
public
DebugSessionPostgres
createDebugSession
(
Connection
connectionTarget
)
throws
DebugException
{
SessionInfoPostgres
targetInfo
=
getSessionInfo
(
connectionTarget
);
DebugSessionPostgres
debugSession
=
new
DebugSessionPostgres
(
getSessionInfo
(
this
.
connection
),
targetInfo
,
connectionTarget
);
sessions
.
put
(
targetInfo
.
getPid
(),
debugSession
);
return
debugSession
;
}
@Override
public
boolean
isSessionExists
(
Integer
id
)
{
return
sessions
.
containsKey
(
id
);
}
@Override
public
void
terminateSession
(
Integer
id
)
{
DebugSessionPostgres
session
=
sessions
.
get
(
id
);
if
(
session
!=
null
)
{
session
.
close
();
sessions
.
remove
(
id
);
}
}
@Override
public
List
<
DebugSession
<?,
?,
Integer
>>
getDebugSessions
()
throws
DebugException
{
return
new
ArrayList
<
DebugSession
<?,
?,
Integer
>>(
sessions
.
values
());
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugObjectPostgres.java
浏览文件 @
476448cb
...
...
@@ -14,74 +14,59 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.postgresql.pldbg.impl
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.DebugObject
;
@SuppressWarnings
(
"nls"
)
public
class
DebugObjectPostgres
implements
DebugObject
<
Integer
>
{
private
final
Integer
oid
;
private
final
String
proname
;
private
final
String
owner
;
private
final
String
schema
;
private
final
String
lang
;
/**
* @param oid
* @param proname
* @param owner
* @param schema
* @param lang
*/
public
DebugObjectPostgres
(
Integer
oid
,
String
proname
,
String
owner
,
String
schema
,
String
lang
)
{
super
();
this
.
oid
=
oid
;
this
.
proname
=
proname
;
this
.
owner
=
owner
;
this
.
schema
=
schema
;
this
.
lang
=
lang
;
}
public
String
getOwner
()
{
return
owner
;
}
public
String
getSchema
()
{
return
schema
;
}
public
String
getLang
()
{
return
lang
;
}
@Override
public
Integer
getID
()
{
return
oid
;
}
@Override
public
String
getName
()
{
return
proname
;
}
@Override
public
String
toString
()
{
return
"id:"
+
String
.
valueOf
(
oid
)
+
", name: `"
+
proname
+
"("
+
lang
+
")"
+
", user: "
+
owner
+
"("
+
schema
+
")"
;
}
private
final
Integer
oid
;
private
final
String
proname
;
private
final
String
owner
;
private
final
String
schema
;
private
final
String
lang
;
public
DebugObjectPostgres
(
Integer
oid
,
String
proname
,
String
owner
,
String
schema
,
String
lang
)
{
super
();
this
.
oid
=
oid
;
this
.
proname
=
proname
;
this
.
owner
=
owner
;
this
.
schema
=
schema
;
this
.
lang
=
lang
;
}
public
String
getOwner
()
{
return
owner
;
}
public
String
getSchema
()
{
return
schema
;
}
public
String
getLang
()
{
return
lang
;
}
@Override
public
Integer
getID
()
{
return
oid
;
}
@Override
public
String
getName
()
{
return
proname
;
}
@Override
public
String
toString
()
{
return
"id:"
+
String
.
valueOf
(
oid
)
+
", name: `"
+
proname
+
"("
+
lang
+
")"
+
", user: "
+
owner
+
"("
+
schema
+
")"
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugSessionPostgres.java
浏览文件 @
476448cb
此差异已折叠。
点击以展开。
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugSessionResult.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg.impl
;
public
class
DebugSessionResult
{
private
final
boolean
result
;
private
final
Exception
exception
;
public
DebugSessionResult
(
boolean
result
,
Exception
exception
)
{
super
();
this
.
result
=
result
;
this
.
exception
=
exception
;
}
public
boolean
isResult
()
{
return
result
;
}
public
Exception
getException
()
{
return
exception
;
}
private
final
boolean
result
;
private
final
Exception
exception
;
public
DebugSessionResult
(
boolean
result
,
Exception
exception
)
{
super
();
this
.
result
=
result
;
this
.
exception
=
exception
;
}
public
boolean
isResult
()
{
return
result
;
}
public
Exception
getException
()
{
return
exception
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/DebugSessionWorker.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg.impl
;
import
java.sql.Connection
;
...
...
@@ -7,27 +24,30 @@ import java.util.concurrent.Callable;
public
class
DebugSessionWorker
implements
Callable
<
DebugSessionResult
>
{
private
final
Connection
conn
;
private
String
sql
=
""
;
public
void
execSQL
(
String
sqlCommand
)
{
this
.
sql
=
sqlCommand
;
}
public
DebugSessionWorker
(
Connection
conn
)
{
this
.
conn
=
conn
;
}
@Override
public
DebugSessionResult
call
()
throws
Exception
{
try
(
Statement
stmt
=
conn
.
createStatement
())
{
stmt
.
executeQuery
(
sql
);
return
new
DebugSessionResult
(
true
,
null
);
}
catch
(
SQLException
e
)
{
return
new
DebugSessionResult
(
false
,
e
);
}
}
private
final
Connection
conn
;
private
String
sql
=
""
;
public
void
execSQL
(
String
sqlCommand
)
{
this
.
sql
=
sqlCommand
;
}
public
DebugSessionWorker
(
Connection
conn
)
{
this
.
conn
=
conn
;
}
@Override
public
DebugSessionResult
call
()
throws
Exception
{
try
(
Statement
stmt
=
conn
.
createStatement
())
{
stmt
.
executeQuery
(
sql
);
return
new
DebugSessionResult
(
true
,
null
);
}
catch
(
SQLException
e
)
{
return
new
DebugSessionResult
(
false
,
e
);
}
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/PostgresBreakpoint.java
浏览文件 @
476448cb
...
...
@@ -14,74 +14,78 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.postgresql.pldbg.impl
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.Breakpoint
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.DebugException
;
@SuppressWarnings
(
"nls"
)
public
class
PostgresBreakpoint
implements
Breakpoint
{
private
final
DebugObjectPostgres
obj
;
private
final
DebugSessionPostgres
session
;
private
final
BreakpointPropertiesPostgres
properties
;
private
static
final
String
SQL_SET_GLOBAL
=
"select pldbg_set_global_breakpoint(?sessionid, ?obj, ?line, ?target)"
;
private
static
final
String
SQL_SET
=
"select pldbg_set_breakpoint(?sessionid, ?obj, ?line, ?target)"
;
public
PostgresBreakpoint
(
DebugSessionPostgres
session
,
DebugObjectPostgres
obj
,
BreakpointPropertiesPostgres
properties
)
throws
DebugException
{
this
.
session
=
session
;
this
.
obj
=
obj
;
this
.
properties
=
properties
;
try
(
Statement
stmt
=
session
.
getConnection
().
createStatement
())
{
String
sqlCommand
=
properties
.
isGlobal
()
?
SQL_SET_GLOBAL
:
SQL_SET
;
stmt
.
executeQuery
(
sqlCommand
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
session
.
getSessionId
()))
.
replaceAll
(
"\\?obj"
,
String
.
valueOf
(
obj
.
getID
()))
.
replaceAll
(
"\\?line"
,
properties
.
isOnStart
()
?
"-1"
:
String
.
valueOf
(
properties
.
getLineNo
()))
.
replaceAll
(
"\\?target"
,
properties
.
isAll
()
?
"null"
:
String
.
valueOf
(
properties
.
getTargetId
())));
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
@Override
public
DebugObjectPostgres
getObj
()
{
return
obj
;
}
@Override
public
void
drop
()
throws
DebugException
{
// TODO Auto-generated method stub
}
@Override
public
BreakpointPropertiesPostgres
getProperties
()
{
return
properties
;
}
@Override
public
String
toString
()
{
return
"PostgresBreakpoint [obj="
+
obj
+
", session id ="
+
session
.
getSessionId
()
+
", properties="
+
properties
+
"]"
;
}
private
final
DebugObjectPostgres
obj
;
private
final
DebugSessionPostgres
session
;
private
final
BreakpointPropertiesPostgres
properties
;
private
static
final
String
SQL_SET_GLOBAL
=
"select pldbg_set_global_breakpoint(?sessionid, ?obj, ?line, ?target)"
;
private
static
final
String
SQL_SET
=
"select pldbg_set_breakpoint(?sessionid, ?obj, ?line)"
;
private
static
final
String
SQL_DROP
=
"select pldbg_drop_breakpoint(?sessionid, ?obj, ?line)"
;
public
PostgresBreakpoint
(
DebugSessionPostgres
session
,
DebugObjectPostgres
obj
,
BreakpointPropertiesPostgres
properties
)
throws
DebugException
{
this
.
session
=
session
;
this
.
obj
=
obj
;
this
.
properties
=
properties
;
try
(
Statement
stmt
=
session
.
getConnection
().
createStatement
())
{
String
sqlCommand
=
properties
.
isGlobal
()
?
SQL_SET_GLOBAL
:
SQL_SET
;
stmt
.
executeQuery
(
sqlCommand
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
session
.
getSessionId
()))
.
replaceAll
(
"\\?obj"
,
String
.
valueOf
(
obj
.
getID
()))
.
replaceAll
(
"\\?line"
,
properties
.
isOnStart
()
?
"-1"
:
String
.
valueOf
(
properties
.
getLineNo
()))
.
replaceAll
(
"\\?target"
,
properties
.
isAll
()
?
"null"
:
String
.
valueOf
(
properties
.
getTargetId
())));
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
@Override
public
DebugObjectPostgres
getObj
()
{
return
obj
;
}
@Override
public
void
drop
()
throws
DebugException
{
try
(
Statement
stmt
=
session
.
getConnection
().
createStatement
())
{
stmt
.
executeQuery
(
SQL_DROP
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
session
.
getSessionId
()))
.
replaceAll
(
"\\?obj"
,
String
.
valueOf
(
obj
.
getID
()))
.
replaceAll
(
"\\?line"
,
properties
.
isOnStart
()
?
"-1"
:
String
.
valueOf
(
properties
.
getLineNo
())));
}
catch
(
SQLException
e
)
{
throw
new
DebugException
(
e
);
}
}
@Override
public
BreakpointPropertiesPostgres
getProperties
()
{
return
properties
;
}
@Override
public
String
toString
()
{
return
"PostgresBreakpoint [obj="
+
obj
+
", session id ="
+
session
.
getSessionId
()
+
", properties="
+
properties
+
"]"
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/PostgresStackFrame.java
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg.impl
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.StackFrame
;
public
class
PostgresStackFrame
implements
StackFrame
{
private
final
int
level
;
private
final
String
name
;
private
final
String
oid
;
private
final
int
lineNo
;
private
final
String
args
;
public
PostgresStackFrame
(
int
level
,
String
name
,
String
oid
,
int
lineNo
,
String
args
)
{
super
();
this
.
level
=
level
;
this
.
name
=
name
;
this
.
oid
=
oid
;
this
.
lineNo
=
lineNo
;
this
.
args
=
args
;
}
public
int
getLevel
()
{
return
level
;
}
public
String
getOid
()
{
return
oid
;
}
public
int
getLineNo
()
{
return
lineNo
;
}
private
final
int
level
;
private
final
String
name
;
private
final
int
oid
;
private
final
int
lineNo
;
private
final
String
args
;
public
PostgresStackFrame
(
int
level
,
String
name
,
int
oid
,
int
lineNo
,
String
args
)
{
super
();
this
.
level
=
level
;
this
.
name
=
name
;
this
.
oid
=
oid
;
this
.
lineNo
=
lineNo
;
this
.
args
=
args
;
}
public
int
getLevel
()
{
return
level
;
}
public
String
getArgs
()
{
return
args
;
}
public
int
getOid
()
{
return
oid
;
}
@Override
public
int
getLine
()
{
return
lineNo
;
}
public
String
getArgs
()
{
return
args
;
}
@Override
public
String
getName
()
{
return
name
;
}
@Override
public
String
getName
()
{
return
name
;
}
@Override
public
String
toString
()
{
return
"PostgresStackFrame [level="
+
level
+
", name="
+
name
+
", oid="
+
oid
+
", lineNo="
+
lineNo
+
", args="
+
args
+
"]"
;
}
@Override
public
String
toString
()
{
return
"PostgresStackFrame [level="
+
level
+
", name="
+
name
+
", oid="
+
oid
+
", lineNo="
+
lineNo
+
", args="
+
args
+
"]"
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/PostgresVariable.java
0 → 100644
浏览文件 @
476448cb
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2017 Andrew Khitrin (ahitrin@gmail.com)
*
* 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.pldbg.impl
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.Variable
;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.VariableType
;
public
class
PostgresVariable
implements
Variable
<
String
>
{
private
final
String
name
;
private
final
String
varclass
;
private
final
int
linenumber
;
private
final
boolean
unique
;
private
final
boolean
constant
;
private
final
boolean
notnull
;
private
final
int
oid
;
private
final
String
val
;
@Override
public
String
getVal
()
{
return
val
;
}
@Override
public
String
getName
()
{
return
name
;
}
@Override
public
VariableType
getType
()
{
// TODO Auto-generated method stub
return
VariableType
.
TEXT
;
}
public
PostgresVariable
(
String
name
,
String
varclass
,
int
linenumber
,
boolean
unique
,
boolean
constant
,
boolean
notnull
,
int
oid
,
String
val
)
{
super
();
this
.
name
=
name
;
this
.
varclass
=
varclass
;
this
.
linenumber
=
linenumber
;
this
.
unique
=
unique
;
this
.
constant
=
constant
;
this
.
notnull
=
notnull
;
this
.
oid
=
oid
;
this
.
val
=
val
;
}
public
String
getVarclass
()
{
return
varclass
;
}
public
int
getLinenumber
()
{
return
linenumber
;
}
public
boolean
isUnique
()
{
return
unique
;
}
public
boolean
isConstant
()
{
return
constant
;
}
public
boolean
isNotnull
()
{
return
notnull
;
}
public
int
getOid
()
{
return
oid
;
}
@Override
public
String
toString
()
{
return
"PostgresVariable [name="
+
name
+
", val="
+
val
+
", varclass="
+
varclass
+
", linenumber="
+
linenumber
+
", unique="
+
unique
+
", constant="
+
constant
+
", notnull="
+
notnull
+
", oid="
+
oid
+
"]"
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/pldbg/impl/SessionInfoPostgres.java
浏览文件 @
476448cb
...
...
@@ -19,70 +19,56 @@ package org.jkiss.dbeaver.ext.postgresql.pldbg.impl;
import
org.jkiss.dbeaver.ext.postgresql.pldbg.SessionInfo
;
/**
* @author Andrey.Hitrin
*
*/
@SuppressWarnings
(
"nls"
)
public
class
SessionInfoPostgres
implements
SessionInfo
<
Integer
>
{
public
static
final
String
CREATE_LISTEN
=
"CREATE LISTEN"
;
final
int
pid
;
final
String
user
;
final
String
application
;
final
String
state
;
final
String
query
;
@Override
public
Integer
getID
()
{
return
pid
;
}
public
SessionInfoPostgres
(
int
pid
,
String
user
,
String
application
,
String
state
,
String
query
)
{
super
();
this
.
pid
=
pid
;
this
.
user
=
user
;
this
.
application
=
application
;
this
.
state
=
state
;
this
.
query
=
query
;
}
public
static
final
String
CREATE_LISTEN
=
"CREATE LISTEN"
;
final
int
pid
;
final
String
user
;
final
String
application
;
final
String
state
;
final
String
query
;
@Override
public
Integer
getID
()
{
return
pid
;
}
public
SessionInfoPostgres
(
int
pid
,
String
user
,
String
application
,
String
state
,
String
query
)
{
super
();
this
.
pid
=
pid
;
this
.
user
=
user
;
this
.
application
=
application
;
this
.
state
=
state
;
this
.
query
=
query
;
}
public
int
getPid
()
{
return
pid
;
}
public
int
getPid
()
{
return
pid
;
}
public
String
getUser
()
{
return
user
;
}
public
String
getUser
()
{
return
user
;
}
public
String
getApplication
()
{
return
application
;
}
public
String
getApplication
()
{
return
application
;
}
public
String
getState
()
{
return
state
;
}
public
String
getState
()
{
return
state
;
}
public
String
getQuery
()
{
return
query
;
}
public
String
getQuery
()
{
return
query
;
}
@Override
public
String
toString
()
{
@Override
public
String
toString
()
{
return
"pid:"
+
String
.
valueOf
(
pid
)
+
", user: "
+
user
+
", application: `"
+
application
+
"`, state: "
+
state
+
", query: "
+
query
.
replace
(
'\n'
,
'\\'
)
;
}
return
"pid:"
+
String
.
valueOf
(
pid
)
+
", user: "
+
user
+
", application: `"
+
application
+
"`, state: "
+
state
+
", query: "
+
query
.
replace
(
'\n'
,
'\\'
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录