 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Lutz Kutscher Guest
|
Posted: Tue Aug 17, 2004 7:27 pm Post subject: cancel during asyncfetchnonblocking |
|
|
Hi,
I wanted to use the ExecuteOption eoAsyncFetchNonBlocking to build a
progressive filtering form:
In the OnShow event of my form I open a query on a large table
(20,000+ records):
"select * from HugeTable"
Since it is opened in non blocking mode, the user can enter a search
string into a TEdit control.
The OnChange of that TEdit looks like this:
TMyForm.Edit1Change(Sender: TObject);
begin
AdoDS.Close;
AdoDS.CommandText := 'select * from HugeTable where SearchField='''
+ Edit1.Text + '''';
AdoDS.Open;
end;
The problem with this seems to be, that the query is not really cancelled
with the
AdoDS.Close - looking at my memory usage it climbs incredibly.
I tried using the OnFetchProgress event to set EventStatus to esCancel
- the name and declaration as var parameter sounded like it could work -
nothing.
Can anyone around here tell me, how to really tell ADO to stop loading the
data that isn't needed any longer?
Thanks a lot
Lutz
|
|
| Back to top |
|
 |
Martijn Tonies Guest
|
Posted: Wed Aug 18, 2004 7:28 am Post subject: Re: cancel during asyncfetchnonblocking |
|
|
| Quote: | AdoDS.Close;
AdoDS.CommandText := 'select * from HugeTable where SearchField='''
+ Edit1.Text + '''';
AdoDS.Open;
end;
The problem with this seems to be, that the query is not really cancelled
with the
AdoDS.Close - looking at my memory usage it climbs incredibly.
I tried using the OnFetchProgress event to set EventStatus to esCancel
- the name and declaration as var parameter sounded like it could work -
nothing.
Can anyone around here tell me, how to really tell ADO to stop loading
the
data that isn't needed any longer?
Try
AdoDS.Recordset.Cancel;
AdoDS.Close;
|
Did you test this?
Can you use the same object for another query?
I've been spending quite some time with all sorts of
settings but can't seem to get this working in an OK
manner.
--
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
|
|
| Back to top |
|
 |
Lutz Kutscher Guest
|
Posted: Wed Aug 18, 2004 5:35 pm Post subject: Re: cancel during asyncfetchnonblocking |
|
|
On Tue, 17 Aug 2004 20:08:37 -0500, Brian Bushay TeamB <BBushay (AT) Nmpls (DOT) com>
wrote:
| Quote: | AdoDS.Recordset.Cancel;
AdoDS.Close;
|
Hey, great, thanks.
I just didn't realize the possibilities the direct access to the RecordSet
object opens.
- It would have been nicer though, had the delphi developers integrated
that feature into
the delphi implementation of ADO.
The reason I didn't find it, was mainly, that I tried to find something in
the Delphi help
on TAdoDataSet and forgot to look into Microsoft's help.
Well, anyway, you made my day.
Lutz
|
|
| Back to top |
|
 |
Martijn Tonies Guest
|
Posted: Thu Aug 19, 2004 2:27 pm Post subject: Re: cancel during asyncfetchnonblocking |
|
|
Hi Brian,
| Quote: | AdoDS.Recordset.Cancel;
AdoDS.Close;
Did you test this?
Not with the code posted
Can you use the same object for another query?
I do not understand your question
|
I've been trying to get such a cancel -- running the
ado stuff in a thread, cancelling from the main thread.
Although I could get it to cancel, the following could happen:
- it kept on loading data into the local memory
or
- it cancelled just fine, but running a query in the same
command object failed horribly
All in all, I can't say it actually works.
--
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|