I couldn't find any answer for my question so I'm writing.

Are there any restrictions for updating strings in SQLite database ? I'm wondering if any new value is written into database file there could be problem for strings of different length. Isn't it ? I anticipate that I update strings in database and their length will be different. In such situation should I store them into files and store only file names into database ? Please give me some optimization tips.

  • I dont understand your problem, in normal cases you should have your strings in your database in VARCHAR-columns with a fixed width like VARCHAR(63) so different string lengths don't really matter as long as the strings you want to store do not exceed this predefined field width. I don't know for sqlite, but I guess if they were longer than the field in that they are stored, they will just be truncated. In any case you should have an idea what could be the maximum size of strings you need to be able to store, before trying to store them ;) – DrCopyPaste Sep 24 '13 at 9:10
  • @DrCopyPaste SQLite always uses variable-length strings and does not enforce length limits. – CL. Sep 25 '13 at 9:04
  • @CL. thx for the notice, I just saw some samples on the web and most of them used the usually seen syntax of VARCHAR(n), so I just blindly assumed SQLite would respect that – DrCopyPaste Sep 25 '13 at 9:20

SQLite can resize field values and records dynamically, so there are no restrictions on updating strings (except for the normal limits).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.