On Thu, 10 Dec 2009, Paul van Helden wrote:

Hi All,

A client has changed a field type in a SQLite db from INTEGER to TEXT. My app now crashes on a AField.AsInteger:=1; (Invalid type conversion to integer in field...)

Should the correct behaviour not be to simply convert to text in the AsInteger setter and attempt StrToInt in the getter before raising an exception?

First of all, your client should not change the field type. If you use persistent fields, opening the dataset will go wrong, as a
TIntegerField is declared, and the query will expect a TStringField to be
present.

As for attempting to converting string fields to integer, this is debatable; I'm not particularly against it, but I'm not yet sure of all the
consequences.

Please post a feature request in the FPC bugtracker.

Michael.


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to