Andrew Watkins wrote:

I'm creating a client application in .Net and I am leaning towards the idea of keeping the database open for the life of the program as opposed to closing it after every transaction or group of statements.

What I wanted to know was could the database be corrupted if the program was
shutdown improperly while the database was open, especially on old versions of
windows, like 95/98?


No. Program crashes, OS crashes, and power failures should not corrupt an SQLite database.

The above statement should always be true for program crashes.
In order to avoid corruption due to OS crashes or power
failures, a couple of other assumptions are required:

  (1)  Your PRAGMA synchronous setting should be ON or FULL.
       (The default is ON.)

  (2)  Your implementation of windows must honor the
       FlushFileBuffers() system call.  I'm told that on
       some versions of windows that function does not
       work as advertised.

If your program goes crazy and starts overwriting SQLite's
internal data structures before it crashes, then all bets
are off, of course.  On the other hand, programs that are
that sick usually die long before they have a chance to
cause any real trouble for the database.

--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to