What is the difference between integer data types in sqlite?
INT
INTEGER
TINYINT
SMALLINT
MEDIUMINT
BIGINT
UNSIGNED BIG INT
INT2
INT8
Which one can store 32-bit integers and which one can store 64-bit values? Is there support for 128-bit?
I find integer data size a little confusing for now, INTEGER for example can store up to 64-bit signed integers, but values may occupy only 32 bits on disk.
Calling sqlite3_column_int on an INTEGER column will work only if the value stored is less that int32 max value, how will it behave if higher?
From the SQLite3 documentation:
http://www.sqlite.org/datatype3.html
So in MS Sql Server (for example), an “int” == “integer” == 4 bytes/32 bits.
In contrast, a SqlLite “integer” can hold whatever you put into it: from a 1-byte char to an 8-byte long long.
The above link lists all types, and gives more details about Sqlite “affinity”.
The C/C++ interface you’re referring to must work with strongly typed languages.
So there are two APIs: sqlite3_column_int(), max 4-byte; and sqlite3_column_int64()
http://www.sqlite.org/capi3ref.html#sqlite3_int64