If you want to use that POSIX record locking, use a flat file. Then you
can lock a section of it. A DBMS like Sqlite is a web of linked records
and shares the structures which maintain the links. Row and table
locking requires other structures.
Since Sqlite is a library, not a server, and you link it into your
application, there is nothing to stop you using locking and
synchronization primitives like mutexes, events and semaphores to
establish your own co-operative locking.
Cesar David Rodas Maldonado wrote:
So, is imposible to read alway and write one per time... ?
On 7/25/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:
I just want to read always and write one time.. understand? is that
imposible?
On 7/25/06, Robert Simpson <[EMAIL PROTECTED] > wrote:
>
> > -----Original Message-----
> > From: Cesar David Rodas Maldonado [mailto: [EMAIL PROTECTED]
> > Sent: Tuesday, July 25, 2006 8:07 AM
> > To: sqlite-users@sqlite.org
> > Subject: [sqlite] Sqlite Write and read a the same time
> >
> > Hello!
> >
> > The weekend I was reading a book "Programming in Linux" and I found
> > something for me very cool!. I so that you could Lock a File
> > for write but
> > just a part of the file. And I am wondering if in Linux
> > SQLite would be able
> > to lock just a Page of the B-tree when you are doing the
> > insert and the
> > update, that will be better I think that Lock all the File
(database).
> >
> > The function is in the header < fcntl.h> and the function is:
> >
> > int fcntl(int fd, int cmd, struct flock *lock_type);
> >
>
> The problem is that when SQLite is updating, it needs to lock a lot
more
> than just the page its updating.
>
> When pages are moved, rewritten, added, etc, all the references need to
> be
> written. The master pages need updating. You can't update all those
> other
> pages during a write op and expect readers to continue to be able to
> read in
> a consistent state.
>
> Robert
>
>
>