Problem
Integer columns are read with the 32-bit sqlite3_column_int instead of the 64-bit sqlite3_column_int64:
FetchRecordsQuery::GetColumnValue (src/queries.cc): case SQLITE_INTEGER: return std::to_wstring(sqlite3_column_int(stmt_, col));
FetchMaxIdQuery::GetMaxId (src/queries.cc): reads sqlite3_column_int(stmt_, 0) and returns it as int64_t.
Impact
Any stored int64_t value above INT32_MAX (2,147,483,647) is silently truncated/wrapped on read. This is not a corner case: id is int64_t and with INTEGER PRIMARY KEY AUTOINCREMENT ids can legitimately exceed the 32-bit range, after which fetched ids become wrong — breaking subsequent Fetch(id) / Update / Delete.
Suggested direction
Use sqlite3_column_int64 for integer columns (in both GetColumnValue and GetMaxId). Add a regression test that stores and fetches a value greater than INT32_MAX.
Problem
Integer columns are read with the 32-bit
sqlite3_column_intinstead of the 64-bitsqlite3_column_int64:FetchRecordsQuery::GetColumnValue(src/queries.cc):case SQLITE_INTEGER: return std::to_wstring(sqlite3_column_int(stmt_, col));FetchMaxIdQuery::GetMaxId(src/queries.cc): readssqlite3_column_int(stmt_, 0)and returns it asint64_t.Impact
Any stored
int64_tvalue aboveINT32_MAX(2,147,483,647) is silently truncated/wrapped on read. This is not a corner case:idisint64_tand withINTEGER PRIMARY KEY AUTOINCREMENTids can legitimately exceed the 32-bit range, after which fetched ids become wrong — breaking subsequentFetch(id)/Update/Delete.Suggested direction
Use
sqlite3_column_int64for integer columns (in bothGetColumnValueandGetMaxId). Add a regression test that stores and fetches a value greater thanINT32_MAX.