SQLite3 Integer Max Value
Regarding the second question:
You can store IP address in DB in 2 ways:
- As a String. This is recommended as it will support both IPv4 and IPv6 and does not require no additional hassle with IP address conversions.
- As an integer. IP is basically 4 bytes that can all be merged into one integer value. However, do you really want that? That will give you loads of pain converting it to/from string any time it is required.
INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
The INTEGER storage class, for example, includes 6 different integer datatypes of different lengths. This makes a difference on disk. But as soon as INTEGER values are read off of disk and into memory for processing, they are converted to the most general datatype (8-byte signed integer).
from http://www.sqlite.org/datatype3.html
Unless you have some other reason not to, you can store IP address using TEXT.
- Look at http://www.sqlite.org/datatype3.html Minimum is -(263) == -9223372036854775808 and maximum is 263 - 1 == 9223372036854775807
- I would think you should use a varchar
- http://www.sqlite.org/lang_attach.html
- http://www.sqlite.org/lang_createtable.html
- might be of help SQLite 'no such table' error
in general check out the sqlite documentation