Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
6ee6a474
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,发现更多精彩内容 >>
提交
6ee6a474
编写于
1月 06, 2018
作者:
A
Andrew Khitrin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Variables set
Former-commit-id:
a3ae5902
上级
2faade9c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
151 addition
and
3 deletion
+151
-3
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/console/Debugger.java
...eaver/ext/postgresql/debug/internal/console/Debugger.java
+112
-2
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSession.java
...t/postgresql/debug/internal/impl/PostgreDebugSession.java
+39
-1
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/console/Debugger.java
浏览文件 @
6ee6a474
...
...
@@ -28,7 +28,6 @@ import org.jkiss.dbeaver.debug.DBGSession;
import
org.jkiss.dbeaver.debug.DBGStackFrame
;
import
org.jkiss.dbeaver.debug.DBGVariable
;
import
org.jkiss.dbeaver.ext.postgresql.debug.internal.impl.*
;
import
org.jkiss.dbeaver.ext.postgresql.debug.internal.impl.PostgreDebugBreakpoint
;
@SuppressWarnings
(
"nls"
)
public
class
Debugger
{
...
...
@@ -55,6 +54,79 @@ public class Debugger {
public
static
final
String
COMMAND_HELP
=
"?"
;
public
static
final
String
ANY_ARG
=
"*"
;
public
static
DBGVariable
<?>
chooseVariable
(
Scanner
sc
,
PostgreDebugSessionManager
pgDbgManager
,
PostgreDebugSession
session
)
throws
DBGException
{
DBGVariable
<?>
v
=
null
;
List
<
DBGVariable
<?>>
vars
=
session
.
getVarables
();
Scanner
scArg
;
if
(
vars
.
size
()
==
1
)
{
v
=
(
PostgreDebugVariable
)
vars
.
get
(
0
);
}
else
{
System
.
out
.
println
(
"Choose variable (0 for quit) :"
);
int
varNo
=
1
;
for
(
DBGVariable
<?>
cv
:
vars
)
{
System
.
out
.
println
(
String
.
format
(
" (%d) %s"
,
varNo
++,
cv
.
toString
()));
}
int
varId
=
-
1
;
while
(
varId
<
0
)
{
String
argc
=
sc
.
nextLine
();
String
strvarid
=
""
;
scArg
=
new
Scanner
(
argc
);
if
(
scArg
.
hasNext
())
{
strvarid
=
scArg
.
next
();
if
(
strvarid
.
trim
().
length
()
>
0
)
{
try
{
varId
=
Integer
.
valueOf
(
strvarid
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
String
.
format
(
"Incorrect var ID %s"
,
strvarid
));
varId
=
-
1
;
}
if
(
varId
==
0
)
{
break
;
}
if
(
varId
>
vars
.
size
())
{
System
.
out
.
println
(
String
.
format
(
"Incorrect var ID %s"
,
strvarid
));
varId
=
-
1
;
}
else
{
v
=
vars
.
get
(
varId
-
1
);
break
;
}
}
}
scArg
.
close
();
}
}
return
v
;
}
public
static
PostgreDebugBreakpoint
chooseBreakpoint
(
Scanner
sc
,
PostgreDebugSessionManager
pgDbgManager
,
PostgreDebugSession
session
)
throws
DBGException
{
...
...
@@ -339,7 +411,45 @@ public class Debugger {
break
;
case
COMMAND_VARIABLE_SET:
System
.
out
.
println
(
"VARIABLE_SET!!!"
);
String
strVal
=
""
;
String
argcV
=
sc
.
nextLine
();
if
(
argcV
.
length
()
>
0
)
{
scArg
=
new
Scanner
(
argcV
);
if
(
scArg
.
hasNext
())
{
strVal
=
scArg
.
next
();
}
scArg
.
close
();
}
if
(
pgDbgManager
.
getDebugSessions
().
size
()
==
0
)
{
System
.
out
.
println
(
"Debug sessions not found"
);
break
;
}
PostgreDebugSession
debugSessionVS
=
chooseSession
(
sc
,
pgDbgManager
);
if
(
debugSessionVS
==
null
)
{
break
;
}
DBGVariable
<?>
var
=
chooseVariable
(
sc
,
pgDbgManager
,
debugSessionVS
);
if
(
var
==
null
)
{
break
;
}
debugSessionVS
.
setVariableVal
(
var
,
strVal
);
System
.
out
.
println
(
String
.
format
(
"Variable Set %s"
,
strVal
));
break
;
case
COMMAND_BREAKPOINT:
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSession.java
浏览文件 @
6ee6a474
...
...
@@ -19,6 +19,7 @@
package
org.jkiss.dbeaver.ext.postgresql.debug.internal.impl
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
...
...
@@ -28,12 +29,14 @@ import java.util.concurrent.ExecutionException;
import
java.util.concurrent.FutureTask
;
import
java.util.concurrent.locks.ReentrantReadWriteLock
;
import
org.eclipse.debug.core.DebugException
;
import
org.jkiss.dbeaver.debug.DBGBreakpoint
;
import
org.jkiss.dbeaver.debug.DBGBreakpointProperties
;
import
org.jkiss.dbeaver.debug.DBGException
;
import
org.jkiss.dbeaver.debug.DBGSession
;
import
org.jkiss.dbeaver.debug.DBGStackFrame
;
import
org.jkiss.dbeaver.debug.DBGVariable
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement
;
@SuppressWarnings
(
"nls"
)
public
class
PostgreDebugSession
implements
DBGSession
<
PostgreDebugSessionInfo
,
PostgreDebugObject
,
Integer
>
{
...
...
@@ -55,6 +58,8 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
private
static
final
String
SQL_LISTEN
=
"select pldbg_create_listener() as sessionid"
;
private
static
final
String
SQL_GET_VARS
=
"select * from pldbg_get_variables(?sessionid)"
;
private
static
final
String
SQL_SET_VAR
=
"select pldbg_deposit_value(?,?,?,?)"
;
private
static
final
String
SQL_GET_STACK
=
"select * from pldbg_get_stack(?sessionid)"
;
...
...
@@ -294,7 +299,40 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
@Override
public
void
setVariableVal
(
DBGVariable
<?>
variable
,
Object
value
)
throws
DBGException
{
// TODO Auto-generated method stub
acquireReadLock
();
try
(
PreparedStatement
stmt
=
connection
.
prepareStatement
(
SQL_SET_VAR
))
{
if
(
variable
instanceof
PostgreDebugVariable
){
if
(
value
instanceof
String
){
PostgreDebugVariable
var
=
(
PostgreDebugVariable
)
variable
;
stmt
.
setInt
(
1
,
sessionId
);
stmt
.
setString
(
2
,
var
.
getName
());
stmt
.
setInt
(
3
,
var
.
getLinenumber
());
stmt
.
setString
(
4
,(
String
)
value
);
stmt
.
execute
();
}
else
{
lock
.
readLock
().
unlock
();
throw
new
DBGException
(
"Incorrect variable value class"
);
}
}
else
{
lock
.
readLock
().
unlock
();
throw
new
DBGException
(
"Incorrect variable class"
);
}
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
}
finally
{
lock
.
readLock
().
unlock
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录