[fpc-pascal] Re: Variant vs Pointer

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Fri Mar 2 17:02:34 CET 2012



On Fri, 2 Mar 2012, Marcos Douglas wrote:

> On Wed, Feb 29, 2012 at 10:38 PM, Marcos Douglas <md at delfire.net> wrote:
>> Hi,
>>
>> The TField class have the FValueBuffer: Pointer attribute and have
>> also SetData(Buffer: Pointer,...) method that all T***Field subclasses
>> use to set themselves.
>> The methods AsInteger, AsString, etc use FValueBuffer to convert in an
>> especific type. So, FValueBuffer could be anything.
>>
>> My question is:
>> What would be the difference in performance if FValueBuffer were a Variant type?
>>
>> Marcos Douglas
>
> Nobody knows?
>
> I need implements a similar structure but I need know if the use of
> Variant have very cost.

It has a cost.

The reason for using a buffer in tdataset is that a record's data normally 
is located in one continuous buffer, from which a value is picked from the
right spot (including strings) You can't have that with variants.

Michael.



More information about the fpc-pascal mailing list