Whats the best SQLite data type for a long string

You should use TEXT.

Although, that's the same thing as VARCHAR:

If the declared type of the column contains any of the strings "CHAR", "CLOB", or "TEXT" then that column has TEXT affinity. Notice that the type VARCHAR contains the string "CHAR" and is thus assigned TEXT affinity

And also:

Note that numeric arguments in parentheses that following the type name (ex: "VARCHAR(255)") are ignored by SQLite - SQLite does not impose any length restrictions (other than the large global SQLITE_MAX_LENGTH limit) on the length of strings, BLOBs or numeric values.

"SQLite does not impose any length restrictions"


Yor have 2 choices to store a long String in SQLite

  1. TEXT type - SQLite support very long text (I don't know exact number but I tested 33000 char SQLite3)
  2. BLOB type: You can use BLOB Data type to hold long String.

Actually, all data types in SQLite is no matter, all data will be stored as strings. You can execute query CREATE TABLE(uId INT PRIMARY KEY, linkList BlahBlahString); without any error. Data type in SQLite is for sql compability only

Tags:

Sql

Sqlite