[fpc-devel] Recent changes to TField.SetData

Luiz Americo Pereira Camara luizmed at oi.com.br
Tue Apr 5 09:37:46 CEST 2011


On 5/4/2011 02:41, LacaK wrote:
>
>>>>
>>>> Then please move approprate code at least into 
>>>> TCustomBufDataset.SetFieldData
>>>> Thanks
>>>
>>> This code was already there.
>>>
>>> Should the 'Validate' code be moved there too ?
>>
>> Yes. TDataset descendants are responsible to calling Validate, e.g., 
>> zeos call it inside TZAbstractRODataset.SetFieldData.
> I agree, but I do not like idea, that SAME piece of code must be 
> repeated in many descendants of TDataSet (TCustomBufDataSet, TParadox, 
> TMemDataset,  TFixedFormatDataSet,  TDbf, TCustomSqliteDataset etc.)
>

If it was just adding the call before SetFieldData it would take less 
than 10min, but it's necessary to know where to put so does not break 
something.

> So it would be good, if we can put 'validate code' into any new 
> method? and call it once from descendants (be precise only from 
> descendants, which are intended for use in FPC, because components 
> which are also for Delphi must do it in Delphi compatible way and can 
> not use this new method)

It's just to lines of code.

>
>>
>> One of the reasons of letting descendants call it it's too improve 
>> granularity so Validate can be called in the middle of the routine, 
>> as is in zeos, instead to  force the call before the TDataset routine.
> Yes, but I think, that in many cases can be expected, that 'validate' 
> will be called before any other action,

It's necessary to do some checks before calling it.

Luiz



More information about the fpc-devel mailing list