Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
7776319a
Commit
7776319a
authored
Feb 26, 2002
by
Dave Cramer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementation for cancelQuery by Grant Finnemore <grantf@guruhut.co.za>
parent
29e3ef0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+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
No files found.
src/interfaces/jdbc/org/postgresql/Connection.java
View file @
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
View file @
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
View file @
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment