In the OnCreate of my data module, I have the following lines (using Interbase 2020):
var
LGenerator: TInterbaseSQLGenerator;
begin
inherited;
LGenerator := TSQLGeneratorRegister.GetInstance.GetGenerator('Interbase') as TInterbaseSQLGenerator;
LGenerator.UseBoolean := true;
This works perfectly but now, in my code after connecting to the database, I am trying to add:
var
DBManager: TDatabaseManager;
begin
// Ensures the database schema is up-to-date
DBManager := TDatabaseManager.Create(Connection);
try
DBManager.UpdateDatabase; // Also tried ValidateDatabase...
finally
DBManager.Free;
end;
However, in all situations I get the following exception:
SQLGeneration: Field type ftBoolean is not supported on Interbase SQL Generator
This is somewhat confusion because the call fails on procedure TAnsiSQLGenerator.DefineColumnType in unit Aurelius.Sql.AnsiSQLGenerator.
How can I fix this so that schema changes can be applied?
Are you saying that schema validating, updating etc. is not possible at all with Interbase (2020) when boolean fields are used? In this case, I'm building an application for myself so that updating the schema (adding a table etc) can be done "manually". However, for databases distributed with commercial applications this would be an issue.
It also confuses me that I select/register the TInterbaseSQLGenerator but the code fails on the TAnsiSQLGenerator.
Will this be addressed/solved in an update in the near future or can you recommend another approach to address this issue for databases distributed with my applications?
Well, I just made a statement - granted, not very helpful to you - informing that UseBoolean only applies to Firebird3. Reason is actually very simple - we didn't bother nor have received requests to update it to Interbase.
I'm not sure how much Interbase is different from Firebird these days, as they were very similar in past, but I believe that if you use dialect Firebird3 instead of Interbase it will just work fine. Can you please try it?
This is just a simple implementation detail, all database-specific generators inherit from TAnsiSQLGenerator, so a code might fail in it. Actually most of the code is implemented in the ancestor, very little code is added to each generator - if you check source code in units Aurelius.Sql.Interbase and Aurelius.Sql.Firebird you will understand what I mean.
I have tried several variations but can't get it to work. I also need to update settings to the FireDac connection, change used units etc. so it all becomes a bit messy and I want to finish this application. For now I will therefore add the table manually via an SQL script.
In the meantime I filed a request to update the Interbase SQL generator.....