In its simplest form, below is a pseudo code of the problem:
enum E { VALUE = -1; }
uint32_t value = VALUE; // signed to unsigned conversion without typecasting
SQLiteDB.INSERT(<table containing `value`>);
SQLiteDB.SELECT(<same table as above>);
In the DB, I see that the value
is stored as 4294967295
(i.e. 0xFFFFFFFF
) which is correct. But when the value is read from the DB, it is truncated as 2147483647
(0x7FFFFFFF
) which is appx half of the original value.
Why is that? How to solve this problem?
Update: As informed above, the value 0xFFFFFFFF is visible in SQLite properly, but when read in the uint32_t
back, it's truncated. Possibly is it a data loss?
Below is an image seen with SQLiteBrowser on the actual data.
Related but not duplicate: