[fpc-pascal] Coping a DataSet

Marcos Douglas md at delfire.net
Mon Dec 3 18:45:40 CET 2012


On Mon, Dec 3, 2012 at 2:32 PM, Michael Van Canneyt
<michael at freepascal.org> wrote:
>
>
> On Mon, 3 Dec 2012, Marcos Douglas wrote:
>
>> On Mon, Dec 3, 2012 at 2:03 PM,  <michael.vancanneyt at wisa.be> 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



More information about the fpc-pascal mailing list