TurboMagic 92 Posted December 23, 2022 (edited) Hello, I'm using D11.2 with FireDAC and a Firebird database. I have just set ExtendedMetadata in the DB Connection params to true to solve some other issues in some new part of the application. When running the app now this leads to a crash in previously working code. x := In that previously working code I do a FieldByName('MyColumn').AsInteger; The column is specified as SmallInt via some self defined domain. The crash now is an exception: First chance exception at $7720E292. Exception class EDatabaseError with message 'Feld 'MyColumn' cannot get accessed as type Integer . Process MyApp.exe (11560) (message translated from german) Why dos this crash now and how to fix it with .AsSmallInt not being available? Ok, I found out that it thinks my column to be a boolean now. But how does he know this? The dmomain is defined as SmallInt and no constraints. Edited December 23, 2022 by TurboMagic Share this post Link to post
programmerdelphi2k 237 Posted December 23, 2022 (edited) have you used "Data MAPping Rules" to convert your FB field to Delphi usage? Edited December 23, 2022 by programmerdelphi2k Share this post Link to post
programmerdelphi2k 237 Posted December 23, 2022 41 minutes ago, TurboMagic said: Ok, I found out that it thinks my column to be a boolean now. But how does he know this? The dmomain is defined as SmallInt and no constraints. https://docwiki.embarcadero.com/RADStudio/Sydney/en/Extended_Metadata_(FireDAC) using "domain name" or size Share this post Link to post
Uwe Raabe 2057 Posted December 23, 2022 Quote Q3: How can I force FireDAC to recognize some field as boolean? A: A boolean field may be created using a domain. The domain name must contain 'BOOL' substring. Also, add ExtendedMetadata=True parameter to your connection definition. For example: CREATE DOMAIN T_BOOLEAN SMALLINT; CREATE TABLE ... ( ... BOOLEAN_FIELD T_BOOLEAN, ...); Share this post Link to post
Serge_G 87 Posted December 24, 2022 Since FB.3 boolean type exists https://firebirdsql.org/file/documentation/chunk/en/refdocs/fblangref30/fblangref30-datatypes-booleantypes.html Share this post Link to post
TurboMagic 92 Posted December 24, 2022 Thanks for all the answers. It detected it since my domain contains "BOOLEAN" in its name. Learned something with this now. Good to know about boolean type in FB 3, but the application is currently still on 2.5. Can't do everything at the same time... 😉 Share this post Link to post