Board index » delphi » ClientDataSet question

ClientDataSet question


2004-11-27 03:34:16 AM
delphi20
Hi,
I'm developing a muiti-database application that supports ADO and IBX, and
I'm using like this:
(TADOQuery or TIBQuery) -->TProvider -->TClientDataSet
I connect the TProvider to TADOQuery or TIBQuery depending on a parameter,
where it is specified what database I will use (Interbase or SQLServer).
The problem is when I am selecting a large amount of records, 50000 and over,
for instance, it takes almost 2 minuts to open. Why it takes so long? Is
this the better way for building muiti-database applications? If it is not,
what would be?
Thanks for any help.
 
 

Re:ClientDataSet question

Jzlio Cesar writes:
Quote
The problem is when I am selecting a large amount of records, 50000
and over, for instance, it takes almost 2 minuts to open. Why it
takes so long? Is this the better way for building muiti-database
applications? If it is not, what would be?
Sounds like it is bringing all 50,000 records back to the client and
caching them. Why so many records ?
--
Rob Schieck
TeamB
 

Re:ClientDataSet question

Hi,
Here goes:
1. In just one case I need to cache them all, because I generate a binary file using the ClientDataSet so that I can use the records from this file in another application that just make consults :)
2. I use so many records because I record all the records from a products table in this file. This file is used at a point-of-sale supermarket application that cannot depends on the server. If something happens to the server, the supermarket cannot stop selling :)
3. Is there a way to work like if I were using the TIBQuery or TADOQuery, were I can navegate through the records using a ClientDataSet and a Provider without caching them?
4. I use ClientDataSet and a Provider to make easier work with multi-databases, because I just need to connect the Provider at the specific query (TIBQuery or TADOQuery)! I there a better way to build multi-database appplications?
Thanks!
"Robert Schieck (TeamB)" <>writes:
Quote
Jzlio Cesar writes:

>The problem is when I am selecting a large amount of records, 50000
>and over, for instance, it takes almost 2 minuts to open. Why it
>takes so long? Is this the better way for building muiti-database
>applications? If it is not, what would be?

Sounds like it is bringing all 50,000 records back to the client and
caching them. Why so many records ?


--
Rob Schieck
TeamB
 

Re:ClientDataSet question

If you are writing the records to an external file why not bring the
records to the client in small batchs and write the records out as they
are received? Than you will not need to cache the records in the
client. For an example see
bdn.borland.com/article/0,1410,25982,00.html
--
Bill (TeamB)
TeamB cannot answer questions received via email
 

Re:ClientDataSet question

Is your clientdatasets fetch on demand property set to true ?
--
Rob Schieck
TeamB
 

Re:ClientDataSet question

Yes, its by default.
<Robert Schieck (TeamB)>escreveu na mensagem
Quote
Is your clientdatasets fetch on demand property set to true ?


--
Rob Schieck
TeamB
 

Re:ClientDataSet question

Ok, about the file I understood.
Now if you can explain me these two points, I will be very thankful.
First:
Is there a way to work with ClientDataSet were I can navegate through the
records without caching them?
Second:
Why selecting all the 50000 records using TADOQuery and a ClientDataSet
takes much longer (very very much longer!) than selecting the same records
using TIBQuery and a ClientDataSet?
Thanks once more!
"Bill Todd" <XXXX@XXXXX.COM>escreveu na mensagem
Quote
If you are writing the records to an external file why not bring the
records to the client in small batchs and write the records out as they
are received? Than you will not need to cache the records in the
client. For an example see
bdn.borland.com/article/0,1410,25982,00.html

--
Bill (TeamB)
TeamB cannot answer questions received via email
 

Re:ClientDataSet question

Jzlio Cesar writes:
Quote
First:
Is there a way to work with ClientDataSet were I can navegate through
the records without caching them?
I have never tried this but you might be able to set FetchOnDemand to
true, set PacketRecords to some number, then call GetNextPacket,
process the records, call EmptyDataSet, then call GetNextPacket etc.
Quote

Second:
Why selecting all the 50000 records using TADOQuery and a
ClientDataSet takes much longer (very very much longer!) than
selecting the same records using TIBQuery and a ClientDataSet?
Are you using a server side forward only cursor with ADO?
Are you using a unidirectional cursor with IBX?
 

Re:ClientDataSet question

I would expect IBX with Unidirectional=True + CDS to be faster than
dbExpress, however, I have never done any precise timings.
--
Bill (TeamB)
TeamB cannot answer questions received via email
Jzlio Cesar writes:
Quote
Sorry, I didn't pay attention on the cursor. Now its running better.
I made a test with DBX and it is faster then both. I will think about
using DBX for SQL Server and for Interbase.
 

Re:ClientDataSet question

Sorry, I didn't pay attention on the cursor. Now its running better.
I made a test with DBX and it is faster then both. I will think about using DBX
for SQL Server and for Interbase.
Thanks a lot! :)
"Bill Todd" <XXXX@XXXXX.COM>escreveu na mensagem
Quote
Jzlio Cesar writes:

>First:
>Is there a way to work with ClientDataSet were I can navegate through
>the records without caching them?

I have never tried this but you might be able to set FetchOnDemand to
true, set PacketRecords to some number, then call GetNextPacket,
process the records, call EmptyDataSet, then call GetNextPacket etc.

>
>Second:
>Why selecting all the 50000 records using TADOQuery and a
>ClientDataSet takes much longer (very very much longer!) than
>selecting the same records using TIBQuery and a ClientDataSet?

Are you using a server side forward only cursor with ADO?

Are you using a unidirectional cursor with IBX?
 

Re:ClientDataSet question

Hi all,
I have a Delphi 6 stand alone application that I am planning on
redeveloping as a client/server app.
I am thinking of running the Firebird server, IBExpress,
with each of my client apps utilising ClientDataSets (CDS) to
manipulate clientside data, etc,.
I was considering connectin MS Access to my CDS as my client
side "briefcase", then applying updates back to the server once
my user had shut down the application (via a secondary system
tray application).
Is this the correct use of the CDS with the briefcase model?
The reason that I thought of using something like Access is that
when my client app disconnects from the network (ie laptop users)
they may well need to take up to 10,000 customer records with
them to work with in the "briefcase" model.
From my readings on the CDS it only seems useful if you want to
store a handful of records in a local XML file, rather than many
thousands?
Is this right? Am I just getting it all wrong here?
Many thanks,
jason.