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 for
  Advanced Search

PQcancel hangs



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 | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group