On Tue, Dec 7, 2010 at 12:10 AM, uncle.f <ad...@sboxx.org> wrote: > Could Anybody please help? > > We are running SQLite 3.7.3 on an embedded device and using C API to > interact with the DB. One of our goals is to ensure that the database > never grows past certain size (which is very small for this embedded box). > > We open DB connection once and would like to keep it open for the > whole duration of C application. > The following PRAGMAs are used to open the database: > > page_size=1024 > max_page_count=5120 > count_changes=OFF > journal_mode=OFF > temp_store=MEMORY > > When we hit the limit with the INSERT statement we get back > SQLITE_FULL, which is fine and is expected at some point. However, all > subsequent SELECTs or, in fact, any other DB interactions return > SQLITE_CORRUPT. That is until we close and re-open the same database > again, we can then SELECT,DELETE and UPDATE without a problem. > > Is this intended behaviour? > Are we doing something wrong? >
When you set journal_mode=OFF, then SQLite is unable to recover from any kind of disk I/O error, either internal or external, because it is unable to ROLLBACK the transaction in progress. That means when it reaches the max_page_count, the database will go corrupt, since running out of disk space is a kind of internal disk I/O error. There isn't really anything that can be done about this since it is not possible to know the size of a transaction in advance. The journal_mode=OFF parameter is not a recommended setting for applications that care about data preservation. > Thanks in advance, > > Andrei > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users