I am trying to create an application which will write to an SQLite
table with an INSERT to add a new row to a table at the conclusion
of every user session.  However, I also would like to backup the user's
session-in-progress in case their computer crashes, loses power, etc.
One way of doing this would be to INSERT the row initially with the
initial data, and then UPDATE it (I think) every few minutes, possibly
just in one of the fields, as the user's session progresses.  But I am
concerned this might be unsafe.  Since the table in question is the sole
record of all of the user's sessions, I am worried about UPDATING it and
somehow by mistake UPDATING the wrong row or somehow corrupting
the table's structure.  Or if something crashes during the update that the
important table will get fouled up somehow.

I wondered if it would be safer or more recommendable to commit the
saves to another table first, and then use that table at the conclusion of
the user's session to, in one step, commit the changes to the main table
with an INSERT?  (and then to clear that table completely for the next
session).  This way, for each session there is only one INSERT to the
main table and no UPDATING, and so it strikes me as less prone to a
catastrophe.  But maybe this has its own problems (one of which is it is
just more work to code).

Or is this not really a concern?

Thanks (very new to databases and to SQLite)
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to