[fpc-devel] Should TAutoIncField be read only?
Luiz Americo Pereira Camara
luizmed at oi.com.br
Wed May 19 19:14:16 CEST 2010
Joost van der Sluis escreveu:
> On Wed, 2010-05-19 at 00:32 -0300, Luiz Americo Pereira Camara wrote:
>> Until a few moments ago i would say yes because it seems logical and fpc
>> raises an exception when trying to set the value programatically.
>> But while investigating why TAutoIncField.ReadOnly always returns false,
>> i found that, regardless of FReadOnly being set to true in the
>> constructor, this value is overriden in TFieldDef.CreateField throung
>> Attributes.faReadOnly flag.
>> So i tested in Delphi (TClientDatset and TDbf) and found that
>> TAutoIncField.ReadOnly is false (like fpc).
>> So what should fpc do:
>> - Follow delphi behavior and let TAutoIncField.ReadOnly return False?
>> - Fix TAutoIncField.ReadOnly to return True?
> That's not fixing it, that's breaking it. Readonly have to be false for
> autoincremental fields.
I'm just confused by the exception that is raised ("autoinc fields are
read only") when trying to set a value and by the code in the
TAutoIncField constructor that initializes FReadOnly to true.
Attached is a patch that removes this initialization.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the fpc-devel