From: drh
SQLite is typeless. All data is stored as null-terminated strings. + The datatype information that follows the column name in CREATE TABLE + statements is ignored (mostly). You can put any type of data you want + into any column, without regard to the declared datatype of that column. +
+ +An exception to this rule is a column of type INTEGER PRIMARY KEY. + Such columns must hold an integer. An attempt to put a non-integer + value into an INTEGER PRIMARY KEY column will generate an error.
+} + faq { SQLite lets me insert a string into a database column of type integer! } { @@ -189,6 +203,12 @@ faq { adjust this behavior from C code using the sqlite_busy_handler() or sqlite_busy_timeout() API functions. See the API documentation for details. + +If two or more processes have the same database open and one + process creates a new table or index, the other processes might + not be able to see the new table right away. You might have to + get the other processes to close and reopen their connection to + the database before they will be able to see the new table.
} faq { @@ -205,6 +225,12 @@ faq { returned from separate calls to sqlite_open(). It is never safe to use the same sqlite structure pointer simultaneously in two or more threads. + +Note that if two or more threads have the same database open and one + thread creates a new table or index, the other threads might + not be able to see the new table right away. You might have to + get the other threads to close and reopen their connection to + the database before they will be able to see the new table.
} faq { @@ -255,7 +281,7 @@ ORDER BY name; } faq { - Are there any known size limits to SQLite databases. + Are there any known size limits to SQLite databases? } {Internally, SQLite can handle databases up to 2^40 bytes (1 terabyte) in size. But the backend interface to POSIX and Win32 limits files to @@ -278,6 +304,36 @@ faq { number of columns, etc. Indices are similarly unconstrained.
} +faq { + What is the maximum size of a VARCHAR in SQLite? +} { +Remember, SQLite is typeless. A VARCHAR column can hold as much + data as any other column. The total amount of data in a single row + of the database is limited to 1 megabyte. You can increase this limit + to 16 megabytes, if you need to, by adjusting a single #define in the + source tree and recompiling.
+ +For maximum speed and space efficiency, you should try to keep the + amount of data in a single row below about 230 bytes.
+} + +faq { + Does SQLite support a BLOB type? +} { +You can declare a table column to be of type "BLOB" but it will still + only store null-terminated strings. This is because the only way to + insert information into an SQLite database is using an INSERT SQL statement, + and you can not include binary data in the middle of the ASCII text string + of an INSERT statement.
+ +SQLite is 8-bit clean with regard to the data is stores as long as + the data does not contain any NUL characters. If you want to store binary + data, consider encoding your data in such a way that it contains no NUL + characters and inserting it that way. You might use URL-style encoding: + encode NUL as "%00" and "%" as "%25". Or you might consider encoding your + binary data using base-64.
+} + faq { How do I add or delete columns from an existing table in SQLite. } {