SQLite BIGINT-type

In TSQLiteSQLGenerator.DefineColumnType I need  BIGINT-type also to be like:


  case Column.FieldType of
    ftLongWord, ftLargeint:        
      Column.DataType := 'BIGINT';
    ftShortint, ftByte, ftSmallint, ftWord, ftInteger:
      Column.DataType := 'INTEGER';

In SQLite, INTEGER and BIGINT are the same "type" (actually there are no types in SQLite, but at least they help in type "affinity"). Is your request based just on the type name, or did you experience some problems with current approach?
Wagner R. Landgraf2016-11-30 12:43:16

Yes, I had this issue with int64 typed integers. In SQLite database field is INGETER. I am using FireDac database connections. Maybe FireDac under needs more exact integer typing.

My application works when I use that mentioned BIGINT-type.

The problem is that it might break backward compatibility. One thing you could do is create a new generator inheriting from the existing one and override the DefineColumnTypeMethod:



TMySQLiteSQLGenerator = class(TSQLiteSQLGenerator)
protected

  procedure DefineColumnType(Column: TColumnMetadata); override;
end;



procedure TMySQLiteSQLGenerator.DefineColumnType(Column: TColumnMetadata);
begin
  case Column.FieldType of
    ftLongWord, ftLargeint:
      begin
         Column.DataType := 'BIGINT';
         if Column.AutoGenerated then
           Column.DataType := Column.DataType + ' PRIMARY KEY AUTOINCREMENT';
      end;
  else
    inherited DefineColumnType(Column);
  end;
end;


then register it to replace the existing dialect:



initialization
  TSQLGeneratorRegister.GetInstance.RegisterGenerator(TMySQLiteSQLGenerator.Create);


Wagner R. Landgraf2016-11-30 18:33:05

Hello,

In which unit can I find

Ok, I found it. (Aurelius.Sql.Metadata)