Article View: borland.public.cppbuilder.database.ado
Article #414TADOCommand::Cancel() has large delay
From: Clayton Arends
Date: Thu, 16 Nov 2006 22:56
Date: Thu, 16 Nov 2006 22:56
53 lines
3163 bytes
3163 bytes
I have created an application to test asynchronous operations in ADO to
improve performance of one of my products. Mostly I'm doing this so that
the user is able to cancel long-running or runaway queries without having to
use task manager.
The problem I have is that the cancel operation doesn't appear to be
cancelling the query at all. The amount of time that the query I am using
takes is around 14 seconds. This same amount of time passes even if I
attempt to cancel the query. As tests I have used a longer running query
and reduced the CommandTimeout of both the command and the connection
without a change in results. I also tried all combinations of the
eoAsyncXXX options in TADOCommand::ExecuteOptions (aside from the starting
point which I mention below).
Configuration
------------
I added a TADOConnection to the form and set ConnectOptions to
[coAsyncConnect]. I am using an Oracle 10G connection at my office (using
an Oracle OLEDB driver on my computer). I added a TADOCommand to the form
and set ExecuteOptions to [eoAsyncExecute]. I added a TEdit to specify a
SQL statement and a TMemo which receives status information. I added a
TButton which executes the command or, if a command is executing, cancels a
command:
if (ADOCommand1->States.Contains(stExecuting))
{
Memo1->Lines->Add("Cancelling ...");
Memo1->Refresh();
ADOCommand1->Cancel();
Memo1->Lines->Add("Cancelled");
return;
}
ADOCommand1->CommandText = Edit1->Text;
ADOCommand1->Execute();
Memo1->Lines->Add("Executing ...");
So here is what I need to know. Have I configured my test correctly to use
asynchronous ADO? Is Cancel() always a blocking operation? Is Cancel()
optionally supported by the database? If the query is a runaway query
should Cancel() eventually come back?
I have performed some general archive searches on this subject. I found a
few cases where the authors mentioned that Cancel() has a long delay but
none of them mentioned that it was the same amount of time as the normal
running query. Most other posts I found were simply questions regarding how
to cancel long running queries. The answer in those cases was to use
asynchronous ADO.
Thank you for any insight,
- Clayton
Technical Details
Message-ID:
<455cecab$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10698b,8a0716b6d5983fc3,start X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Clayton Arends" <nospam_claytonarends@hotmail.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: TADOCommand::Cancel() has large delay Date: Thu, 16 Nov 2006 14:56:45 -0800 Lines: 55 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 71.83.251.192 Message-ID: <455cecab$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1163717803 71.83.251.192 (16 Nov 2006 14:56:43 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail