Reputation: 75
If I create a table in SQLite on Android:
create table [Table]
(
[Column] varchar(32)
)
Testing my code I can store a string whose length is more than that, so using a limit is useless?
Does something happen internally?
Upvotes: 0
Views: 3681
Reputation: 14408
From sqlite F.A.Q.:
What is the maximum size of a VARCHAR in SQLite?
SQLite does not enforce the length of a VARCHAR. You can declare a VARCHAR(10) and SQLite will be happy to let you put 500 characters in it. And it will keep all 500 characters intact - it never truncates.
From sqlite docs:
[..] numeric arguments in parentheses that following the type name (ex: "VARCHAR(255)") are ignored by SQLite - SQLite does not impose any length restrictions [..]
SQLite understands the column type of "VARCHAR(N)" to be the same as "TEXT", regardless of the value of N.
Upvotes: 5