Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
7776319a
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7776319a
编写于
2月 26, 2002
作者:
D
Dave Cramer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implementation for cancelQuery by Grant Finnemore <grantf@guruhut.co.za>
上级
29e3ef0f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
4 deletion
+54
-4
src/interfaces/jdbc/org/postgresql/Connection.java
src/interfaces/jdbc/org/postgresql/Connection.java
+48
-3
src/interfaces/jdbc/org/postgresql/Statement.java
src/interfaces/jdbc/org/postgresql/Statement.java
+1
-1
src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
+5
-0
未找到文件。
src/interfaces/jdbc/org/postgresql/Connection.java
浏览文件 @
7776319a
...
...
@@ -11,7 +11,7 @@ import org.postgresql.util.*;
import
org.postgresql.core.*
;
/*
* $Id: Connection.java,v 1.4
0 2001/12/11 04:44:23 barry
Exp $
* $Id: Connection.java,v 1.4
1 2002/02/26 02:15:54 davec
Exp $
*
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class.
...
...
@@ -91,6 +91,40 @@ public abstract class Connection
public
Connection
()
{}
public
void
cancelQuery
()
throws
SQLException
{
PG_Stream
cancelStream
=
null
;
try
{
cancelStream
=
new
PG_Stream
(
PG_HOST
,
PG_PORT
);
}
catch
(
ConnectException
cex
)
{
// Added by Peter Mount <peter@retep.org.uk>
// ConnectException is thrown when the connection cannot be made.
// we trap this an return a more meaningful message for the end user
throw
new
PSQLException
(
"postgresql.con.refused"
);
}
catch
(
IOException
e
)
{
throw
new
PSQLException
(
"postgresql.con.failed"
,
e
);
}
// Now we need to construct and send a cancel packet
try
{
cancelStream
.
SendInteger
(
16
,
4
);
cancelStream
.
SendInteger
(
80877102
,
4
);
cancelStream
.
SendInteger
(
pid
,
4
);
cancelStream
.
SendInteger
(
ckey
,
4
);
cancelStream
.
flush
();
}
catch
(
IOException
e
)
{
throw
new
PSQLException
(
"postgresql.con.failed"
,
e
);
}
finally
{
try
{
if
(
cancelStream
!=
null
)
cancelStream
.
close
();
}
catch
(
IOException
e
)
{}
// Ignore
}
}
/*
* This method actually opens the connection. It is called by Driver.
*
...
...
@@ -266,8 +300,8 @@ public abstract class Connection
switch
(
beresp
)
{
case
'K'
:
pid
=
pg_stream
.
ReceiveInteger
(
4
);
ckey
=
pg_stream
.
ReceiveInteger
(
4
);
pid
=
pg_stream
.
ReceiveInteger
R
(
4
);
ckey
=
pg_stream
.
ReceiveInteger
R
(
4
);
break
;
case
'E'
:
case
'N'
:
...
...
@@ -281,6 +315,16 @@ public abstract class Connection
switch
(
beresp
)
{
case
'Z'
:
try
{
pg_stream
.
SendChar
(
'Q'
);
pg_stream
.
SendChar
(
' '
);
pg_stream
.
SendChar
(
0
);
pg_stream
.
flush
();
}
catch
(
IOException
e
)
{
throw
new
PSQLException
(
"postgresql.con.ioerror"
,
e
);
}
break
;
case
'E'
:
case
'N'
:
...
...
@@ -448,6 +492,7 @@ public abstract class Connection
* @return the user name
* @exception SQLException just in case...
*/
int
lastMessage
=
0
;
public
String
getUserName
()
throws
SQLException
{
return
PG_USER
;
...
...
src/interfaces/jdbc/org/postgresql/Statement.java
浏览文件 @
7776319a
...
...
@@ -179,7 +179,7 @@ public abstract class Statement
*/
public
void
cancel
()
throws
SQLException
{
// FIXME: Cancel feature has been available since 6.4. Implement it here!
throw
new
PSQLException
(
"postgresql.unimplemented"
);
}
/*
...
...
src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
浏览文件 @
7776319a
...
...
@@ -211,6 +211,11 @@ public class Statement extends org.postgresql.Statement implements java.sql.Stat
return
result
;
}
public
void
Cancel
()
throws
SQLException
{
connection
.
cancelQuery
();
}
public
java
.
sql
.
Connection
getConnection
()
throws
SQLException
{
return
(
java
.
sql
.
Connection
)
connection
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录