Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-12

Coping a DataSet

8 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas

Hi,

What is the faster way to copy a DataSet to another? The FPC provides some functionality for this?

Thanks,
Marcos Douglas

Reply by email

silvioprog
to Marcos Douglas

Guys,

Is "Assign" method implemented for dataset in FPC?

2012/12/3 Marcos Douglas

Show quoted text 7 lines
Hi, What is the faster way to copy a DataSet to another? The FPC provides some functionality for this? Thanks, Marcos Douglas
Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Marcos Douglas
to Unknown author
Show quoted text 12 lines
On Mon, 3 Dec 2012, silvioprog wrote: > Guys, > > Is "Assign" method implemented for dataset in FPC? No, it is not. Datasets differ wildly in how they access and store data. Michael.

But all descendents use TFieds classes so, why not? I can use a loop and the Append method, but this is not faster.

Marcos Douglas

Reply by email

Michael Van Canneyt
to Marcos Douglas
Marcos Douglas wrote 16 lines
On Mon, Dec 3, 2012 at 2:03 PM, wrote: > > > On Mon, 3 Dec 2012, silvioprog wrote: > >> Guys, >> >> Is "Assign" method implemented for dataset in FPC? > > > No, it is not. Datasets differ wildly in how they access and store data. > > Michael. But all descendents use TFieds classes so, why not? I can use a loop and the Append method, but this is not faster.

Speed is not the issue.

There is simply no way to tell what this action will do behind the scenes.

You might for example generate a huge amount of queries, which will presumably all fail, since the records already exist in the database.

Then: Should the transaction be copied ? etc. etc. etc.

In short: it is not implemented, and I doubt it every will be, at least at the TDataset level.

When using a pure TBufDataset, probably it is possible to copy the data package (much like TClientDataset in Delphi), but this would need to be implemented.

Michael.

Reply by email

Marcos Douglas
to Michael Van Canneyt
Michael Van Canneyt wrote 31 lines
On Mon, 3 Dec 2012, Marcos Douglas wrote: > On Mon, Dec 3, 2012 at 2:03 PM, wrote: >> >> >> >> On Mon, 3 Dec 2012, silvioprog wrote: >> >>> Guys, >>> >>> Is "Assign" method implemented for dataset in FPC? >> >> >> >> No, it is not. Datasets differ wildly in how they access and store data. >> >> Michael. > > > But all descendents use TFieds classes so, why not? > I can use a loop and the Append method, but this is not faster. Speed is not the issue. There is simply no way to tell what this action will do behind the scenes. You might for example generate a huge amount of queries, which will presumably all fail, since the records already exist in the database.

I guess I didn't understand you, sorry (thanks for the patience). I'm talking about copy the data only in memory. Do not is necessary check if record already exists.

Then: Should the transaction be copied ? etc. etc. etc.

I want, eg., copy a TZQuery (Zeos) to a TSQLQuery or TBufDataSet.

In short: it is not implemented, and I doubt it every will be, at least at the TDataset level.

I see.
Well, I wont to compare, but C# have ds.Copy and ds.Clone. I needed something like that.
http://msdn.microsoft.com/en-us/library/system.data.dataset.copy.aspx

When using a pure TBufDataset, probably it is possible to copy the data package (much like TClientDataset in Delphi), but this would need to be implemented.

Yes, like a TClientDataSet -- but I think this code is in midas.dll. The ClientDataSet copy data from whatever TDataSet descendent to him and this is fast.

Marcos Douglas

Reply by email

silvioprog
to Marcos Douglas

dbExpress, IBQuery or Zeos implements it?

2012/12/3 Marcos Douglas

Show quoted text 64 lines
On Mon, Dec 3, 2012 at 2:32 PM, Michael Van Canneyt wrote: > > > On Mon, 3 Dec 2012, Marcos Douglas wrote: > >> On Mon, Dec 3, 2012 at 2:03 PM, wrote: >>> >>> >>> >>> On Mon, 3 Dec 2012, silvioprog wrote: >>> >>>> Guys, >>>> >>>> Is "Assign" method implemented for dataset in FPC? >>> >>> >>> >>> No, it is not. Datasets differ wildly in how they access and store data. >>> >>> Michael. >> >> >> But all descendents use TFieds classes so, why not? >> I can use a loop and the Append method, but this is not faster. > > > Speed is not the issue. > > There is simply no way to tell what this action will do behind the scenes. > > You might for example generate a huge amount of queries, which will > presumably all fail, since the records already exist in the database. I guess I didn't understand you, sorry (thanks for the patience). I'm talking about copy the data only in memory. Do not is necessary check if record already exists. > Then: Should the transaction be copied ? etc. etc. etc. > I want, eg., copy a TZQuery (Zeos) to a TSQLQuery or TBufDataSet. > In short: it is not implemented, and I doubt it every will be, at least at > the TDataset level. I see. Well, I wont to compare, but C# have ds.Copy and ds.Clone. I needed something like that. http://msdn.microsoft.com/en-us/library/system.data.dataset.copy.aspx > When using a pure TBufDataset, probably it is possible to copy the data > package > (much like TClientDataset in Delphi), but this would need to be implemented. Yes, like a TClientDataSet -- but I think this code is in midas.dll. The ClientDataSet copy data from whatever TDataSet descendent to him and this is fast. Marcos Douglas
Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Marcos Douglas
to silvioprog
silvioprog wrote 69 lines
2012/12/3 Marcos Douglas > > On Mon, Dec 3, 2012 at 2:32 PM, Michael Van Canneyt > wrote: > > > > > > On Mon, 3 Dec 2012, Marcos Douglas wrote: > > > >> On Mon, Dec 3, 2012 at 2:03 PM, wrote: > >>> > >>> > >>> > >>> On Mon, 3 Dec 2012, silvioprog wrote: > >>> > >>>> Guys, > >>>> > >>>> Is "Assign" method implemented for dataset in FPC? > >>> > >>> > >>> > >>> No, it is not. Datasets differ wildly in how they access and store > >>> data. > >>> > >>> Michael. > >> > >> > >> But all descendents use TFieds classes so, why not? > >> I can use a loop and the Append method, but this is not faster. > > > > > > Speed is not the issue. > > > > There is simply no way to tell what this action will do behind the > > scenes. > > > > You might for example generate a huge amount of queries, which will > > presumably all fail, since the records already exist in the database. > > I guess I didn't understand you, sorry (thanks for the patience). > I'm talking about copy the data only in memory. Do not is necessary > check if record already exists. > > > Then: Should the transaction be copied ? etc. etc. etc. > > > > I want, eg., copy a TZQuery (Zeos) to a TSQLQuery or TBufDataSet. > > > In short: it is not implemented, and I doubt it every will be, at least > > at > > the TDataset level. > > I see. > Well, I wont to compare, but C# have ds.Copy and ds.Clone. I needed > something like that. > http://msdn.microsoft.com/en-us/library/system.data.dataset.copy.aspx > > > When using a pure TBufDataset, probably it is possible to copy the data > > package > > (much like TClientDataset in Delphi), but this would need to be > > implemented. > > Yes, like a TClientDataSet -- but I think this code is in midas.dll. > The ClientDataSet copy data from whatever TDataSet descendent to him > and this is fast. > > Marcos Douglas dbExpress, IBQuery or Zeos implements it?

I do not know about IBQuery or Zeos. The dbExpress, AFAIK, is used together TClientDataSet so, it no needs this functionality, I guess.

Marcos Douglas

Reply by email