Jump to content
TurboMagic

ExtendedMetadata and .AsInteger for small int column

Recommended Posts

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 by TurboMagic

Share this post


Link to post
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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×