[fpc-devel] Should TAutoIncField be read only?
Michael Van Canneyt
michael at freepascal.org
Wed May 19 09:06:31 CEST 2010
On Wed, 19 May 2010, 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?
As far as I know, you can force a value for an autoinc field, so it
is not always read-only. AutoInc means the engine will assign a value
if none is given at insert.
Michael.
More information about the fpc-devel
mailing list