Re: [sqlite] Storing 64-Bit Addresses

2005-03-31 Thread Doug Currie
Thursday, March 31, 2005, 5:53:12 PM, you wrote: >> The actual test I'm doing is something like: >> WHERE ?1 >= (base + begin) AND ?1 < (base + end) >> where ?1, base, begin, and end are all 64-bit addresses. > This is a test with a well known optimization for unsigned values: >

Re: [sqlite] Storing 64-Bit Addresses

2005-03-31 Thread Doug Currie
> The actual test I'm doing is something like: > WHERE ?1 >= (base + begin) AND ?1 < (base + end) > where ?1, base, begin, and end are all 64-bit addresses. This is a test with a well known optimization for unsigned values: WHERE (?1 - base - begin) < end To make the < test unsigned

Re: [sqlite] Storing 64-Bit Addresses

2005-03-31 Thread Jan-Eric Duden
How about storing the 64 bit integers as binaries and write user functions (using sqlite3_create_function ) to do the computation and comparison? William Hachfeld wrote: On Thu, Mar 31, 2005 at 01:52:53PM -0800, Ted Unangst wrote: Store the length of the region, instead of the end. Or is

Re: [sqlite] Storing 64-Bit Addresses

2005-03-31 Thread William Hachfeld
On Thu, Mar 31, 2005 at 01:52:53PM -0800, Ted Unangst wrote: > 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. Sorry Ted, the example I gave was misleading. It was meant purely as an illustration. The

Re: [sqlite] Storing 64-Bit Addresses

2005-03-31 Thread Ted Unangst
William Hachfeld wrote: 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:

Re: [sqlite] Storing 64-Bit Addresses

2005-03-31 Thread Doug Currie
> 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 =

Re: [sqlite] Storing 64-Bit Addresses

2005-03-31 Thread Alex Chudnovsky
William Hachfeld wrote: On Thu, Mar 31, 2005 at 12:07:22PM -0800, Jay wrote: I suppose I could convert the unsigned address into a string. But UINT64_MAX (2^64 - 1) is: 18,446,744,073,709,551,615 which, without the commas, would require 20 bytes to store. Quite a bit more than the 8 bytes

[sqlite] Storing 64-Bit Addresses

2005-03-31 Thread William Hachfeld
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 (