When SQLite steps into a record, all integer values are expanded to 64 bits.
sqlite3_column_int()
returns the lower 32 bits of that value without checking for overflows.
When you call sqlite3_column_bytes()
, SQLite will convert the value to text, and return the number of characters.
You cannot know how large an integer value is before reading it.
Afterwards, you can check the list in the record format documentation for the smallest possible format for that value, but if you want to be sure that integer values are never truncated to 32 bits, you have to always use sqlite3_column_int64()
, or ensure that large values get never written to the DB in the first place (if that is possible).