> > into the matter.
>
> Out of curiosity why won't flock() work?
Process A wants to modify the database, so it flock()s
the rows it needs to changes and starts changing them.
But half way in the middle of the change, somebody sends
process A a SIGKILL and it dies. The OS automatically
releases the flocks as process A dies, leaving the
database half-way updated and in an inconsistent state,
with no locks.
Process B comes along and opens the database, see the
inconsistent state, and reports database corruption.
--
D. Richard Hipp <[EMAIL PROTECTED]>
Perhaps the way do it is journaling files. I have not study SQLite
source codes in detail but i think that before an update or a create
or a delete, it must do a search (so only a read) to know which pages
and which bytes must be modified. So, Process A wants to modify the
database and put on a master table which pages want to modify and
where (from byte M to N), Process B checks the master table and if it
want access the same info, it gets a lock or busy error, if not,
update master table with it own pages and bytes. Process A writes the
changes to pages in a journal file and if Process B was able to
modify do the same in another journal. Both A and B deletes theirs
rows from master table. Then mix both journal files and modify database file.
HTH
------------------------------------------------------------------------------------------------------------------------------------------------------------
#The Unix Guru's View of Sex unzip ; strip ; touch ; grep ; finger ;
mount ; fsck ; more ; yes ; umount ; sleep