Dennis Poon wrote 33 lines
Michael Van Canneyt wrote:
>
>
> On Tue, 1 Oct 2013, Dennis Poon wrote:
>
>> Since TBufDataSet is in-memory, to speed things up, how can I directly
>> access the N'th record and M'th field's value as Variant?
>>>
>>> Simply said: You cannot.
>>>
>>
>> Can any one suggest an in-memory dataset in fpc/lazarus that allows direct
>> access?
>>
>> Does TMemDataset allow it?
>
> No. The architecture of TDataset does not allow this.
>
> The buffer mechanism is quite complicated, and there are quite some layers
> to go through.
>
> T(Mem)Dataset is not just an array of records. The records can be at wildly
> different locations,
> the values may or may not be computed. Blobs are stored entirely in
> different locations etc.
>
> Michael.
>
That is too bad. I used to use TdxMemData from "DevExpress" and it allows
such direct access.
Yes, it is possible to construct such a descendent. But in the general case it is not possible to provide this mechanism.
Maybe bufdataset can be extended to deliver this, but I would not hold my breath waiting for this.
I also used TdxMemData, but didn't see such mechanism. Of course, I never looked for it :)
The benefit is record can be accessed without CHANGING the current record
pointer which will trigger updating of all linked DB controls (that could be
time consuming or even confusing to the user).
I understand the benefits.
But if you need such access, then I think that TDataset is not for you.
Michael.