-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 RanRan wrote: > In the child process, I closed the database and opened a new one for the > child process to use. Won't it fix the problem? Thank you so much again.
No, because after the fork both the parent and the child have the database open. There is a lot more to a SQLite database than just a file handle (like various operating system locks and other data structures). Basically you have to sqlite3_close all databases before doing a fork (don't forget to check the result is SQLITE_OK). If you are going to immediately do an exec then you should be ok - all files/directories are opened with FD_CLOEXEC. Even if SQLite did allow forking with open databases, it would need to be notified in some way before the fork so it could prepare. Pretend the notification function is sqlite3_close :-) Also a common fear seems to be using sqlite3_open multiple times. Unless you are in a seriously constrained embedded environment there is no harm in having lots of database connections even if they are to the same file. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkkdCFIACgkQmOOfHg372QS8HgCfcmHl/0GH3eWV5IMQw0bC1C1+ 8mwAn1PFLfjoK2LwGlFO2wOPwG1WFJCO =d380 -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

