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); My transformation breaks down. E.g. where offset = 8, ? = 4, begin = 2, and end = 3: 4 < (2 + 3) --> true (4 - 8) < ((2 - 8) + (3 - 8)) = -4 < (-6 - 5) = -4 < -11 --> false Darn mathematics anyway! So after that long-winded explanation, my question is simply this. Does anyone have an idea how I can store a 64-bit unsigned integer in an SQLite column and still perform useful arithmetic and conditional operators on them? Thanks in advance for any ideas! -- William Hachfeld