Updating boolean fields with FireDAC and Interbase 2020?

Editing a boolean value (in this case in a DevExpress grid table view / checkbox), updating the database fails with the following error:

Project MyApp.exe raised exception class EIBNativeException with message '[FireDAC][Phys][IB]Dynamic SQL Error
SQL error code = -303
conversion error from string "F"'.

Clearly it's caused by the boolean value being passed as a string value, which is not accepted by Interbase. The actual SQL statement (Call Stack) is

UPDATE Relation SET IsActive = :p1 WHERE ID = :p_1

(Note that I removed '#$D#$A' for readability).

The field in question is defined as

ISACTIVE BOOLEAN DEFAULT true NOT NULL

Is there a setting (Aurelius? FireDAC?) so that False, FALSE or F will be passed (i.e. without quotes)?

Solved after some further searching, so posting here as it may help other in the future to find it more easily.

In the Create of the DataModule where the FireDac and Aurelius connections reside, I added the following code:

constructor TMyDataModule.Create(AOwner: TComponent);
var
  LGenerator: TInterbaseSQLGenerator;
begin
  inherited;
  LGenerator := TSQLGeneratorRegister.GetInstance.GetGenerator('Interbase') as TInterbaseSQLGenerator;
  LGenerator.UseBoolean := true;
end;

Everything now appears to work as required.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.