> So currently from .net code I just say BeginTransaction(ReadCommitted) and do 
> a write operation this locks the complete database file and the write 
> operations are really long. So currently I want to solve the
> locking issue by bringing them down to table locks.

To solve locking issue in SQLite you have to use WAL journal mode.

If you think you absolutely need to use table locks (e.g. to allow
several parallel writers to different tables), you have to use other
DBMS.

But even in other DBMS you will have hard time trying to force readers
to wait while writer transaction is in progress. For that sort of
behavior you need to use your programming language.


Pavel


On Thu, May 3, 2012 at 3:29 PM, Harnek Manj <hm...@gemcomsoftware.com> wrote:
> Hi Simon,
>
> Yes I have multiple Threads which are accessing the database. Currently if I 
> am doing a write operation the whole database file is locked, I want the 
> locking applied only to the table in operation.
>
> So currently from .net code I just say BeginTransaction(ReadCommitted) and do 
> a write operation this locks the complete database file and the write 
> operations are really long. So currently I want to solve the
> locking issue by bringing them down to table locks.
>
> You mentioned "BEGIN EXCLUSIVE TRANSACTION", but I don't see where I can set, 
> that I want to start a transaction with exclusive lock, when I call 
> BeginTransaction on the connection.
>
> Thanks
> Harnek
>
> -----Original Message-----
> From: sqlite-users-boun...@sqlite.org 
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin
> Sent: May-02-12 5:28 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] SQlite exclusive table lock
>
>
> On 3 May 2012, at 1:03am, Harnek Manj <hm...@gemcomsoftware.com> wrote:
>
>> So does it mean that in SQlite there is no way to stop the read operation 
>> while a write operation is running, like table level exclusive lock.
>
> You seem to have jumped straight over the basic features of SQL and looked at 
> some of the most advanced and complicated features.  When you want to block 
> everything else use
>
> BEGIN EXCLUSIVE TRANSACTION
>
> See
>
> <http://sqlite.org/lang_transaction.html>
>
> However, I don't understand why you would want to block a read operation.  
> The difference can matter only when you have multiple threads or processes 
> running at once.  And if you're doing that then there's no harm in getting 
> the data as it was before the write happened.  If the first operation had to 
> finish before the second started, who wouldn't you be doing both operations 
> in the same thread of the same process ?
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to