- what is the maximum value of data type INTEGER in sqlite3 ?
- How do you store ip address in database ?
- What is attached ?
- How to create table which belongs to a specific database using sql ddl?
- What is this error about ?
error while the list of system
catalogue : no such table: temp.sqlite_master
Unable to execute statement
- Does sqlite3 text data type supoports unicode?
Thanks.
- Look at http://www.sqlite.org/datatype3.html Maximum is 2^63-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
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.
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.
- How do you store ip address in database ?
The easiest way is to store the string form (e.g., “127.0.0.1
” or “::1
”) since then you can read them manually and reparsing to an address structure (if you have to) is easy. SQLite likes strings (which use the TEXT type) and handles them efficiently.
Does sqlite3 text data type supports
unicode?
Yes and no.
Yes in that SQLite lets you store TEXT
data in UTF-8 or UTF-16. (Use PRAGMA ENCODING to choose the internal format.)
No in that the built-in LOWER
and UPPER
functions only affect ASCII characters. But you can redefine functions and collations to add this support. There's an ICU extension to SQLite that does this.