On Mon, Sep 17, 2007 at 02:29:58PM +0000, [EMAIL PROTECTED] wrote:

> > BTW: I'm wondering, if there's a possibility to set in similar manner
> > exclusive rights to access the database file for the duration of the entire
> > "database session", not just transaction. I mean: when I'm using a program
> > which is accessing the database - nobody else has access.
> 
> http://www.sqlite.org/pragma.html#pragma_locking_mode

Either I'm doing something incorrectly - or there's something wrong with
that(?).

I made a following test:

1. Ran tclsh in the xterm console, typing the commands:

        sqlite3 dbcomm "/home/myacc/databasefile"
        dbcomm eval {CREATE TABLE version( number VARCHAR(10) )}
        dbcomm eval {INSERT INTO version VALUES('V1.1')}
        dbcomm eval {PRAGMA locking_mode = EXCLUSIVE}   ;# lock mode
        dbcomm eval {SELECT number FROM version}        ;# read access
        dbcomm eval {UPDATE version SET number='V1.2'}  ;# write access

2. Then I ran second tclsh, in another xterm window:

        sqlite3 dbcomm "/home/myacc/databasefile"
        dbcomm eval {SELECT * from version}
        V1.2
        ^^^^
No problem with access! Although the first connection set EXCLUSIVE - the
second one accessed the database without any problem. Then I went out of
tclsh, made su to "root" (to be different user), and tried to connect with
"exclusively locked" database again. Still no problems with connection, as
if there wasn't any lock(?).

Debian Etch, kernel 2.6.22, SQLite 3.3.8.

What exactly did I wrong?
-- 
                                pozdrawiam / regards

                                                Zbigniew Baniewski

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to