Jens Alfke wrote:
> 3. The database is closed with sqlite3_close_v2. The statement is still 
> alive, so the database handle secretly remains open in "zombie mode".
> 4. We delete the database's parent directory and all files in it.
> [...]
> This scenario isn't covered in "How To Corrupt An SQLite Database File"

sqlite3_close_v2() allows statements to be finalized afterwards, but
that finalization must actually happen for the DB to close.

You have a still-active database; this is described in 2.4.

> At the moment I'm not sure what to do about this.

Java's garbage collection handles memory.  For any other kind of
resource, you should use try-with-resources statements.

> (b) Avoid ever reusing the same path. This means we'd have to give the
>     database file inside the wrapper directory a different name every
>     time — instead of just "db.sqlite3" it'd include a UUID or
>     timestamp or something. That of course complicates opening
>     a database, necessitating a directory traversal to discover the
>     file in the directory.

That "wrapper directory" sounds as if you already have a mechanism to
run the test in a custom directory, so use a different directory name.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to