Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
28ba60c7
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,发现更多精彩内容 >>
提交
28ba60c7
编写于
1月 21, 2018
作者:
A
Alexander Fedorov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#2556 normalize debug events
上级
200209e2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
33 deletion
+47
-33
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGBaseSession.java
...ebug.core/src/org/jkiss/dbeaver/debug/DBGBaseSession.java
+9
-10
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGEvent.java
...aver.debug.core/src/org/jkiss/dbeaver/debug/DBGEvent.java
+13
-4
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGWorker.java
...ver.debug.core/src/org/jkiss/dbeaver/debug/DBGWorker.java
+13
-10
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
+12
-9
未找到文件。
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGBaseSession.java
浏览文件 @
28ba60c7
...
...
@@ -39,7 +39,7 @@ public abstract class DBGBaseSession implements DBGSession {
private
final
DBGBaseController
controller
;
private
FutureTask
<
DBGEvent
>
task
;
private
FutureTask
<
Void
>
task
;
private
Thread
workerThread
=
null
;
...
...
@@ -71,7 +71,7 @@ public abstract class DBGBaseSession implements DBGSession {
this
.
connection
=
connection
;
}
p
ublic
DBGBaseController
getController
()
{
p
rotected
DBGBaseController
getController
()
{
return
controller
;
}
...
...
@@ -105,8 +105,7 @@ public abstract class DBGBaseSession implements DBGSession {
}
if
(
task
.
isDone
())
{
try
{
DBGEvent
dbgEvent
=
task
.
get
();
getController
().
fireEvent
(
dbgEvent
);
task
.
get
();
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"DEBUG INTERRUPT ERROR "
,
e
);
return
false
;
...
...
@@ -126,18 +125,18 @@ public abstract class DBGBaseSession implements DBGSession {
* @param name
* @throws DBGException
*/
protected
void
runAsync
(
String
commandSQL
,
String
name
,
DBGEvent
event
)
throws
DBGException
{
protected
void
runAsync
(
String
commandSQL
,
String
name
,
DBGEvent
begin
,
DBGEvent
end
)
throws
DBGException
{
Connection
connection
=
getConnection
();
try
(
Statement
stmt
=
connection
.
createStatement
())
{
connection
.
setAutoCommit
(
false
);
DBGWorker
worker
=
new
DBGWorker
(
connection
,
commandSQL
,
event
);
task
=
new
FutureTask
<
DBGEvent
>(
worker
);
workerThread
=
new
Thread
(
task
);
workerThread
.
setName
(
name
);
workerThread
.
start
();
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
"SQL error"
,
e
);
}
DBGWorker
worker
=
new
DBGWorker
(
this
,
commandSQL
,
begin
,
end
);
task
=
new
FutureTask
<
Void
>(
worker
);
workerThread
=
new
Thread
(
task
);
workerThread
.
setName
(
name
);
workerThread
.
start
();
}
public
void
close
()
{
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGEvent.java
浏览文件 @
28ba60c7
...
...
@@ -24,16 +24,25 @@ public class DBGEvent extends EventObject {
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
int
ATTACH
=
0x0001
;
public
static
final
int
SUSPEND
=
0x0002
;
public
static
final
int
RESUME
=
0x0004
;
public
static
final
int
DETACH
=
0x0008
;
/*
* The event kind constants
*/
public
static
final
int
RESUME
=
0x0001
;
public
static
final
int
SUSPEND
=
0x0002
;
public
static
final
int
CREATE
=
0x0004
;
public
static
final
int
TERMINATE
=
0x0008
;
public
static
final
int
CHANGE
=
0x0010
;
public
static
final
int
MODEL_SPECIFIC
=
0x0020
;
/*
* The event detail constants
*/
public
static
final
int
UNSPECIFIED
=
0
;
public
static
final
int
STEP_INTO
=
0x0001
;
public
static
final
int
STEP_OVER
=
0x0002
;
public
static
final
int
STEP_RETURN
=
0x0004
;
public
static
final
int
STEP_END
=
0x0008
;
public
static
final
int
BREAKPOINT
=
0x0010
;
private
int
kind
;
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGWorker.java
浏览文件 @
28ba60c7
...
...
@@ -19,31 +19,34 @@
package
org.jkiss.dbeaver.debug
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.concurrent.Callable
;
public
class
DBGWorker
implements
Callable
<
DBGEvent
>
{
public
class
DBGWorker
implements
Callable
<
Void
>
{
private
final
Connection
con
n
;
private
final
DBGBaseSession
sessio
n
;
private
final
String
sql
;
private
final
DBGEvent
event
;
private
final
DBGEvent
before
;
private
final
DBGEvent
after
;
public
DBGWorker
(
Connection
conn
,
String
sqlCommand
,
DBGEvent
event
)
public
DBGWorker
(
DBGBaseSession
session
,
String
sqlCommand
,
DBGEvent
begin
,
DBGEvent
end
)
{
this
.
conn
=
con
n
;
this
.
session
=
sessio
n
;
this
.
sql
=
sqlCommand
;
this
.
event
=
event
;
this
.
before
=
begin
;
this
.
after
=
end
;
}
@Override
public
DBGEvent
call
()
throws
Exception
public
Void
call
()
throws
Exception
{
try
(
Statement
stmt
=
conn
.
createStatement
())
{
try
(
Statement
stmt
=
session
.
getConnection
().
createStatement
())
{
session
.
getController
().
fireEvent
(
before
);
stmt
.
executeQuery
(
sql
);
return
event
;
session
.
getController
().
fireEvent
(
after
);
return
null
;
}
catch
(
SQLException
e
)
{
String
message
=
String
.
format
(
"Failed to execute %s"
,
sql
);
throw
new
Exception
(
message
,
e
);
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSession.java
浏览文件 @
28ba60c7
...
...
@@ -133,7 +133,10 @@ public class PostgreDebugSession extends DBGBaseSession {
String
sessionParam
=
String
.
valueOf
(
getSessionId
());
String
taskName
=
sessionParam
+
" global attached to "
+
String
.
valueOf
(
targetId
);
runAsync
(
SQL_ATTACH
.
replaceAll
(
"\\?sessionid"
,
sessionParam
),
taskName
,
new
DBGEvent
(
this
,
DBGEvent
.
ATTACH
));
String
sql
=
SQL_ATTACH
.
replaceAll
(
"\\?sessionid"
,
sessionParam
);
DBGEvent
begin
=
new
DBGEvent
(
this
,
DBGEvent
.
RESUME
,
DBGEvent
.
MODEL_SPECIFIC
);
DBGEvent
end
=
new
DBGEvent
(
this
,
DBGEvent
.
SUSPEND
,
DBGEvent
.
BREAKPOINT
);
runAsync
(
sql
,
taskName
,
begin
,
end
);
/*if (breakpoint) {
runAsync(SQL_ATTACH_BREAKPOINT.replaceAll("\\?sessionid", String.valueOf(sessionId)),
...
...
@@ -198,20 +201,20 @@ public class PostgreDebugSession extends DBGBaseSession {
* Execute step SQL command asynchronously, set debug session name to
* [sessionID] name [managerPID]
*
* @param command
SQL
- SQL command for execute step
* @param name - session 'name' part
* @param command
Pattern
- SQL command for execute step
* @param name
Parameter
- session 'name' part
* @throws DBGException
*/
public
void
execStep
(
String
command
SQL
,
String
name
,
int
eventDetail
)
throws
DBGException
{
public
void
execStep
(
String
command
Pattern
,
String
nameParameter
,
int
eventDetail
)
throws
DBGException
{
acquireWriteLock
();
try
{
DBGEvent
event
=
new
DBGEvent
(
this
,
DBGEvent
.
RESUME
,
eventDetail
);
runAsync
(
commandSQL
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
sessionId
)),
String
.
valueOf
(
sessionId
)
+
name
+
String
.
valueOf
(
targetId
),
event
);
String
sql
=
commandPattern
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
sessionId
)
);
String
taskName
=
String
.
valueOf
(
sessionId
)
+
nameParameter
+
String
.
valueOf
(
targetId
);
DBGEvent
begin
=
new
DBGEvent
(
this
,
DBGEvent
.
RESUME
,
eventDetail
);
DBGEvent
end
=
new
DBGEvent
(
this
,
DBGEvent
.
SUSPEND
,
eventDetail
);
runAsync
(
sql
,
taskName
,
begin
,
end
);
}
finally
{
lock
.
writeLock
().
unlock
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录