Heh Everyone,
Have a question regarding storage of 64-bit unsigned values in SQLite... I'm working on a project where I want to store 64-bit addresses (unsigned values) as a column in an SQLite database. Currently I create the table using signed integers. For example:
CREATE TABLE Example ( begin INTEGER, end INTEGER );
Before binding an address to a statement using sqlite3_bind_int64() I apply an offset to the address to translate it to a signed value. And when reading out an address using sqlite3_column_int64() I reverse the process. I.e.
dbase_value = addr_value - offset addr_value = dbase_value + offset
where offset = ((uin64_t)~0 >> 1) + 1 this works fine for simple uses where I'm just storing and retrieving the value. But if I want to do more complex queries involving arithmetic, for example:
SELECT * From Example WHERE ? < (begin + end);
Store the length of the region, instead of the end. Or is that impossible? I'm not sure what physical property (begin + end) could refer to.
-- Ted Unangst www.coverity.com Coverity, Inc.