Cancelling a Query running in a thread

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
pawelp
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 18.08.2008, 18:10
Location: Poland

Cancelling a Query running in a thread

Post by pawelp »

Hi all,
how can I cancel a Zquery, which is opening in an other thread?
The Query opens some quite huge amount of data, which is displayed afterwards in a Grid.
I perform the Zquery.open call inside a separate thread, so my main Form will not be frozen.
But, the user can close this form while the thread is running. I wish to stop the thread and more importantly the Query. Is there any nice way to do it?

Many Thanks
Pawel
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Which database are you using? I.E. Using firebird SS (not embedded) should be quite simple
pawelp
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 18.08.2008, 18:10
Location: Poland

Post by pawelp »

I'm using Postgres 8.3.9. ZeosLib 6.6.6-stable (from 2009-12-30). Delphi 2007.
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

A solution, not very good, could be:

Add on the uses ZPlainPostgreSqlDriver;

On a procedure
var
PlainDriver: IZPostgreSQLPlainDriver;
begin
...
PlainDriver := IZPostgreSQLPlainDriver(ZConnection1.DbcConnection.GetIZPlainDriver);
PlainDriver.RequestCancel(ZConnection1);
...
pawelp
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 18.08.2008, 18:10
Location: Poland

Post by pawelp »

thanks, I will try it out
pawelp
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 18.08.2008, 18:10
Location: Poland

Post by pawelp »

One small thing so far:
GetIZPlainDriver is undeclared identifier.
But I found the proc GetDriver. I suppose that's the one.
TOLGA
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 06.05.2010, 23:20

Post by TOLGA »

I'm using firebird 2.1 ZeosLib 6.5.6-stable delphi 7
thanks for advice.
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

I think this link and this could help you
Post Reply