From: Ender <fionik@gmail.com>
To: pgsql-interfaces@postgresql.org
Subject: PQcancel hangs
Date: Thu, 19 Jul 2007 17:01:29 +0600
Message-ID: <f7ng9m$168f$1@news.hub.org> (raw)
Hi, all.
I'm trying to cancel query that i'm executing. In the first thread i'm
execute query through PQexec function. Then i'm trying to break it's
execution. From the second thread i'm execute PQgetCancel, PQcancel,
PQfreeCancel. The execution of PQexec get interrupted, however PQcancel
never return control to program.
The execution of PQexec in the first thread get interrupted, however in the
second thread no code executed beyond this line:
Result:=ZPlainPostgreSql8.PQCancel(Cancel,lpszErrBuf,BufSize)=1;
PQCancel never return control to caller. Is it supposed to work at all?
Code sample (Delphi - ZeosDBO):
function TZPostgreSQL8PlainDriver.RequestCancelEx(Handle:
PZPostgreSQLConnect;
out ErrorMessage: String): Boolean;
const
BufSize=256;
var
Cancel:PPGCancel; {actually Pointer}
lpszErrBuf:PAnsiChar;
begin
Result:=FALSE;
ErrorMessage:='';
Cancel:=ZPlainPostgreSql8.PQgetCancel(Handle);
if Cancel=NIL then Exit;
try
lpszErrBuf:=StrAlloc(BufSize);
try
FillChar(lpszErrBuf^,BufSize,0);
Result:=ZPlainPostgreSql8.PQCancel(Cancel,lpszErrBuf,BufSize)=1;
if not Result then
ErrorMessage:=StrPas(lpszErrBuf);
finally
StrDispose(lpszErrBuf);
end;
finally
ZPlainPostgreSql8.PQfreeCancel(Cancel);
end;
end;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: fionik@gmail.com
Subject: Re: PQcancel hangs
In-Reply-To: <f7ng9m$168f$1@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox