Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

PQcancel hangs


  • From: "Ender" <fionik(at)gmail(dot)com>
  • To: pgsql-interfaces(at)postgresql(dot)org
  • Subject: PQcancel hangs
  • Date: Thu, 19 Jul 2007 17:01:29 +0600
  • Message-id: <f7ng9m$168f$1@news.hub.org> <text/plain>

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; 





Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group