Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecify max sqlite db size for my app. How to handle db full exception
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COWhat to do when max size is reached is not a useful question, because then it's too late. You should try to avoid ever reaching the limit by deleting old data; see also http://www.sqlite.org/pragma.html#pragma_auto_vacuum .
      singulars
    2. COI disagree with @CL. Using SQLite as a persistent cache is a legit use case of the maximum size, thus the question is useful. While inserting a new record, it throws SQLiteFullException, so you can purge the oldest record and retry (in a while loop if it's necessary to remove several records to make space for the new one). Implementation note: if the database is empty and you still cannot insert, abort since the single record is bigger than the maximum size.
      singulars
    3. COMarinna's answer is def suffice. You don't need a "listener" here because the exception you get will be synchronous to the operation that you are trying to do. If you just wrap the update/insert functions and check for the exception. If you care about the "limit" that you are given, you can always set the limit to be somewhat less than the actual limit to achieve this. Keep in mind the goal of this is to maintain database size, not to limit the user or yourself in other ways. Besides that, a listener won't be helpful since you could be in anywhere in the application anyways.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload