I noticed that numeric computed fields which calculated correctly in Firebird were being displayed without decimals in Delphi grids. The problem seems to be that the subtype is 0 for a computed decimal field and not 1 as in all the other cases. The field type is INT64 and so wasn't working.
My work around is simple but may not be the best method of fixing this but here it is anyway.
In the TZInterbase6DatabaseMetadata.UncachedGetColumns find the following lines and add this code:
TypeName := GetIntByName('RDB$FIELD_TYPE');
SubTypeName := GetIntByName('RDB$FIELD_SUB_TYPE');
FieldScale := GetIntByName('RDB$FIELD_SCALE');
ColumnName := GetStringByName('RDB$FIELD_NAME');
//Added Code
if isNullByName('RDB$COMPUTED_SOURCE') then //AVZ
begin
//Do Nothing
end
else
begin //Computed by Source
if ((TypeName = 16) and (FieldScale < 0)) then SubTypeName := 1; // Fix for 0 subtype which removes decimals
end;
//End of Added Code
I've submitted this as a bug to the Firebird Development team as I feel that perhaps this is not really a Zeos problem but that the metadata output from Firebird is not being displayed correctly for the computed fields
Computed Fields in Firebird
Moderators: gto, EgonHugeist
-
- Zeos Dev Team
- Posts: 32
- Joined: 22.10.2005, 08:53
- Location: Bloemfontein
- Contact: