> On Sep 27, 2018, at 3:53 AM, Conor Lennon <[email protected]> wrote:
> 
> The problem that I have is retrieving the value using c bindings.
> I'm calling sqlite3_column_int64.
> ...
> When I call the function it returns back 9223372036854775807, which is the 
> maximum size of a signed 64 bit integer (one less than 2 to the power of 63)

How did you store the number? If you called sqlite3_bind_int64, then the value 
should survive the round-trip unscathed, even though SQLite will interpret the 
value as signed. But it’s still the same 64-bit pattern, and if you cast it 
from/to uint64_t it’ll work. (The only problem is that SQLite will think it’s a 
negative number, so sorting and some arithmetic won’t work properly. Addition 
and subtraction will, though.)

But it sounds like you added the value literally to the SQL statement; this is 
a bad idea for many reasons. It’s more expensive to run the query because it 
has to be parsed every single time, you don’t get type-checking or even 
syntax-checking, and if you ever try to do this with strings instead of ints, 
you can easily open yourself up to SQL-injection attacks. Don’t do it!

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

Reply via email to