> 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); It is rather messy, but if you defer offsetting the values until you compare them it should work (except maybe / and %). 1. Don't adjust the values when inserting into db 2. Do adjust the values on either side of a compare. SELECT * From Example WHERE (? + 9223372036854775808) < ((begin + end) + 9223372036854775808); Of course, once you go this route, forget using indexes. e