Yep,
There is hooks on the clientdataset and the TProvider to pass specialised
information between the client and the Provider. See
TProvider.OnDataRequest, OnGetDataSetProperties. Never said it was simple.
Myles.


> -----Original Message-----
> From: Carl Reynolds [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, September 08, 1999 5:10 PM
> To:   Multiple recipients of list delphi
> Subject:      RE: [DUG]:  Efficient searching in TClientDataSet
> 
> [Myles wrote]
> >Are the fields on which the locate is done Indexed (at either the client
> or
> >server end)??
> >
> >If you are using the briefcase model, is suspect it will have to load all
> >the records - an index may help.
> 
> The locate fields are only indexed at the server end inasmuch as they're
> the result of a query with an order-by clause, and I don't have any client
> end indexing (or rather if I do all the records must be brought down
> anyway).
> 
> Looking at TClientDataSet.LocateRecord, I'm not sure an index would help,
> as it seems to call CheckProviderEOF regardless (which loads down
> everything).
> 
> >You could perhaps do some advanced fudging of the IProvider interface -
> >depends on what data requests are sent from the client to the server.
> 
> Sounds hard. :)  I settled for mucking about with
> TClientDataSet.LocateRecord, see below...
> 
> [Yanbo wrote]
> >I have asked the similar question before, unfortuantely none answered it.
> 
> >
> >In my project, when I do a Locate, I pass the Locate( a record number or
> a >range string) params to the middleware, the middle checks the params
> and >prepares a subset of the dataset( normally 1 ~ 100 records) for the
> client >application. 
> >
> >When I started my n-tier prototype, I used the same method as yours.
> >Navigation is very slow.
> 
> Latest developments
> I changed the code in TClientDataSet.LocateRecord as follows:
> 
> begin
>   CheckBrowseMode;
>   CursorPosChanged;
> //  CheckProviderEOF; // Don't want to bring all the data down
>   Buffer := TempBuffer;
>   Fields := TList.Create;
> ...
>         Status := FLookupCursor.GetRecordForKey(FieldCount, PartialLength,
> Buffer, Buffer);
>         if SyncCursor then begin
>                 while (Status <> DBIERR_NONE) and not ProviderEOF and
> FetchOnDemand and (PacketRecords <> 0) do begin
>                         FetchMoreData(false);
>                         Status :=
> FLookupCursor.GetRecordForKey(FieldCount, PartialLength, Buffer, Buffer);
>                 end;
>         end;
> ...
> 
> Basically, every time I search and fail I download another packet.  Not
> exactly what I wanted, as I'm relying _heavily_ on GetRecordForKey being
> efficient, but it does seem to be a lot faster than stepping through
> record by record.  And, unlike the normal locate, I'm only downloading
> packets until I reach the record I want.
> 
> Any perceived flaws or suggested improvements?
> 
> Cheers,
> 
> Carl Reynolds                      Ph: +64-9-4154790
> CJN Technologies Ltd.             Fax: +64-9-4154791
> [EMAIL PROTECTED]                DDI: +64-9-4154795
> PO Box 302-278, North Harbour, Auckland, New Zealand
> 12 Piermark Drive, North Harbour Estate, Auckland, NZ
> Visit our website at http://www.cjntech.co.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to