I've recently started using databases with the included SQLite3 support (units sqldb, sqlite3conn).
sqlite3conn uses sqlite3.dll, which I've used in Delphi with a different wrapper before.
I now have a Trac database, with INTEGER fields that have values that do not fit into a simple 4 byte integer. The Delphi wrapper works fine, and returns the proper data (which is a unix timestamp in microseconds instead of seconds). Lazarus returns something different:
Database: 130442287200000
TSQLQuery.FieldValues: 1843499136
I assume this is broken somewhere in the Int64/UInt64 support.
The FieldType seems to be detected as ftInteger, not ftLargeint. Might be this is the issue, but since it's an external database, I cannot change that, and the Delphi sqlite3.dll wrapper shows that the dll is able to provide correct data anyway.
Workaround attempt 1: I replaced q.FieldValues['time'] with q.FieldByName('time').AsLargeInt, but this did not return the proper value as well.
Workaround attempt 2: I called GetFieldData, which failed the same way.
Workaround attempt 3: I wrote a tracker for TField that would allow me to update the DataType property, and set it to ftLargeint, then called GetFieldData. Failed again. Querying f.AsLargeInt resulted in another number, showing that treatment is a bit different now.
Question: Since this is an external database, I cannot change the database scheme to make those fields largeint instead of int. But since the sqlite3.dll itself is able to handle this, is there any other workaround dealing with Lazarus DB support to get the proper value from the table?