On 2 Sep 2013, at 9:47pm, Michael Foss <foss.m...@gmail.com> wrote:

> I am using SQLite on an embedded system that the user will power off at any
> time (i.e. there is never a clean shut down). The system contains sensors
> and uses a C program with the SQLite library. The sensor data is saved to
> an in-memory database every second. Every 10 seconds, the program saves any
> new data to a database on disk, a USB flash drive.

I assume that 'any new data' is usually more than a single INSERT.

If possible, do the following test: instead of keeping the database open all 
the time, open it and close it as part of your 'every 10 seconds' run.  In 
other words add steps 1 and 5 to the following.

1) ppen database file
2) BEGIN TRANSACTION
3) write your new data
4) END TRANSACTION
5) close database file

This will reduce the possibility of losing data or corrupting the database when 
power fails.  Check to see how much time this adds to the writing process and 
if it's acceptable, keep it.

But what Dr. Hipp wrote is far more important in having your code actually work.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to