> On Aug 21, 2018, at 9:54 AM, Randall Smith <[email protected]> wrote:
> 
> I would like to enthusiastically second not only this as a feature request, 
> but also request arbitrary-length (or at least much longer length) INTEGER 
> values, as are possible in other SQL dialects.  

Bignums make unsigned types irrelevant, if the only reason you need unsigned is 
to store 64-bit positive integers. As others have said, "unsigned" is a 
constraint, not a type.

Bignums would be nice; but you could implement them yourself by storing them as 
blobs and defining functions to operate on them, which would call into some 
available C bignum library.

> There may have been a time in the past when 63 bits was all one could ever 
> conceivably need, but I think we have moved past that time now.  E.g., I have 
> a common need to store software address values, which are (currently!) 64-bit 
> unsigned, and have had to jump through ridiculous hoops in SQLite to do it.  
> Integers in this range, and larger, seem like they are in common use today.

If you're using the C API, you can store and retrieve uint64_t values by 
casting them to int64_t on the way into the SQLite API and back to uint64_t on 
the way out. (You should be able to do similar things with other APIs, but it 
might look uglier.)

Addition, subtraction and bitwise operations should work fine, except for >> 
because it will shift a 1 into the MSB if the number was >= 2^63.

'<' and '>' will work weirdly because there's a discontinuity at 2^63, so any 
number ≥ 2^63 will test as less than any number < 2^63. But you can either use 
SQL logic to work around that, or define a C collation function to compare 
uint64_t's.

(BTW, I'm curious what these address values are. I thought at first you meant 
IPv6 addresses, but those are 128-bit, not 64-bit. Or if you mean addresses in 
the sense of pointers, SQLite now has a C API for representing pointers.)

—Jens
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to