[sqlite] PENDING Lock / Sqlite .NET

1 view
Skip to first unread message

Solanki, Ajay (GE Energy)

unread,
Jan 17, 2012, 1:47:06 AM1/17/12
to sqlite...@sqlite.org
Hi

I have a question on how to enable PENDING LOCK before issuing an
INSERT statement from the C# code.

Do let me know if you can point me to some resources where I can find
the answer or provide me the response.

Regards

Ajay Solanki

+91 98192 54465 <tel:%2B91%2098192%2054465>

_______________________________________________
sqlite-users mailing list
sqlite...@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Simon Slavin

unread,
Jan 17, 2012, 8:27:36 AM1/17/12
to General Discussion of SQLite Database

On 17 Jan 2012, at 6:47am, Solanki, Ajay (GE Energy) wrote:

> I have a question on how to enable PENDING LOCK before issuing an
> INSERT statement from the C# code.

What do you want SQLite to do instead of a pending lock ?

If you want to disable the locking entirely, you can do it with PRAGMAs. Start by looking at "PRAGMA synchronous". (Note: this will lead to corruption of your database if you try to do any multi-access with it.)

If you want to do an immediate lock instead of a pending lock then surround your operations with

BEGIN IMMEDIATE TRANSACTION;
INSERT ...
... other operations ...
END TRANSACTION;

This is is a perfectly normal way of doing things in SQLite and will not lead to corruption.

Simon.

Igor Tandetnik

unread,
Jan 17, 2012, 8:28:14 AM1/17/12
to sqlite...@sqlite.org
Solanki, Ajay (GE Energy) <Ajay.S...@ge.com> wrote:
> I have a question on how to enable PENDING LOCK before issuing an
> INSERT statement from the C# code.

What do you mean, enable PENDING LOCK? It's not something you can enable or disable. SQLite will acquire a pending lock on the database automatically as necessary. For details, see http://www.sqlite.org/lockingv3.html

What are you trying to achieve? Explain your original problem, not your proposed solution.
--
Igor Tandetnik

Reply all
Reply to author
Forward
0 new messages