Article View: borland.public.cppbuilder.database.ado
Article #3228Re: "Killing" a slow query in a Thread - HOW ?
From: Mike Ruskai
Date: Tue, 29 Oct 2002 00:13
Date: Tue, 29 Oct 2002 00:13
38 lines
2930 bytes
2930 bytes
On 28 Oct 2002 05:51:52 -0700, Helcio Mayor wrote: >Dear all, >I have to say that this newgroup is great because always there are altruistic people prompt to help, and I am very content and >greatfull to all. > >Well, I think I have posted similar question but maybe was not clear enough. >Is it possible to call a method or set a property on a query that takes long to return so that it returns ? >If the user chooses to terminate the application, the only option >I have is to kill the Thread that keeps the TADOQuery, but it eventually crashes the main process. I have experimented, and I've determined that using ADO leaves you pretty much no good option for cancelling queries. If you use a server cursor, the query can't be cancelled, period. If you put it on a second thread, and try to kill it, the kill call will block for the same amount of time that it would take the search to complete - in other words, ADO has some hooks into the OS which prevent it from behaving properly. If you use a client cursor, you can call Recordset->Cancel(), which will work fine for an unsorted query. For a sorted query, it will block for about as long as the query would take, sans returning the sorted results - in other words, it's obviously completing the query and sorting it before acknowledging that it was told to stop. Another downside to the client cursor is that large result sets take up big chunks of memory. In general, ADO is not programmer-friendly, and as a direct consequence, not user friendly, either. But it's the only way to use Access 2000 or XP, and Access is still (most unfortunately) the only portable desktop database system. -- - Mike Remove 'spambegone.net' and reverse to send e-mail.
Technical Details
Message-ID:
<gunaalqrneguyvaxarg.h4pva10.pminews@207.105.83.65>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!newsfeed1.cidera.com!Cidera!cyclone2.usenetserver.com!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3dbd40f8$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,bb380d00e2577b40 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-10-28 17:02:02 PST Newsgroups: borland.public.cppbuilder.database.ado From: "Mike Ruskai" <spamten.knilhtrae@begonedynnaht.net> Message-ID: <gunaalqrneguyvaxarg.h4pva10.pminews@207.105.83.65> References: <3dbd40f8$1@newsgroups.borland.com> Date: Mon, 28 Oct 2002 19:13:13 -0500 (EST) Reply-To: "Mike Ruskai" <spamten.knilhtrae@begonedynnaht.net> X-Newsreader: PMINews 2.00.1205 For OS/2 Organization: TLF MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Re: "Killing" a slow query in a Thread - HOW ? NNTP-Posting-Host: 65.40.194.52 X-Trace: newsgroups.borland.com 1035850396 65.40.194.52 (28 Oct 2002 16:13:16 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!newsfeed1.cidera.com!Cidera!cyclone2.usenetserver.com!news.webusenet.com!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail