I have a problem in that I have changed a lot of primary field types in the Firebird tables from Integer to LargeInt. The problem occurs in my Delphi apps when I have persistent fields in the UniTable or UniQuery components. In general I have gone through and removed persistent fields, but there are a couple of occasions where persistent fields are required. This is when I am using calculated or lookup fields as part of the dataset.
The actual problem is that I have customers on the old data structure where these fields are of type Integer, and some customers where the fields are of type Largeint. When the Unitable opens you get an exception of the type "Field type expected to be Largeint but found type Integer". I have tried to trap the exception and simply carry on, but it does not seem to work. The UniTable does not load any data. If I can get the component to simply ignore this error, I would be happy with that - is this possible?
I have seen another post in this forum describing how to add calculated fields at runtime, which seems to be a way to resolve this. ie I need to create all the persistent fields at runtime.
ie
Code: Select all
FSUM := TIntegerField.Create(UniQuery1);
FSUM.FieldName := 'Calc';
FSUM.FieldKind := fkCalculated;
FSUM.DataSet := UniQuery1;
UniQuery1.Open;
Any thoughts along these lines? My preferred solution is to simply trap the exception when opening the table and to carry on.