Re: [sqlite] File Locking And Concurrency In SQLite Version 3

2010-11-12 Thread Prakash Reddy Bande
Hi,

Thanks for the response. That is what I was planning to do, i.e. write some 
code that does the verification before I call sqlite3_open.

However, I am not sure what code should I write. I mean the code I write to do 
the verification should be a representation of what sqlite3 does.

Regards,
 
Prakash Bande
Altair Engg. Inc. 
Troy MI
Ph: 248-614-2400 ext 489
Cell: 248-404-0292

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Friday, November 12, 2010 1:06 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] File Locking And Concurrency In SQLite Version 3


On 12 Nov 2010, at 5:58pm, Prakash Reddy Bande wrote:

> My question: Is it possible to verify if the network drive on which the DB is 
> place can be used?

Great question.  Unfortunately LockFile() generally does /not/ work.  If you 
want to perform a check there are too many combinations of access methods and 
version numbers to use logic.  I can only recommend you write some code that 
actually tries to do the locking and checks to see whether it worked.

I have an application which does something similar in a Unix setup.  It 
requires that the user runs two test applications at the same time -- either on 
the same computer or on two different computers.

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


Re: [sqlite] File Locking And Concurrency In SQLite Version 3

2010-11-12 Thread Simon Slavin

On 12 Nov 2010, at 5:58pm, Prakash Reddy Bande wrote:

> My question: Is it possible to verify if the network drive on which the DB is 
> place can be used?

Great question.  Unfortunately LockFile() generally does /not/ work.  If you 
want to perform a check there are too many combinations of access methods and 
version numbers to use logic.  I can only recommend you write some code that 
actually tries to do the locking and checks to see whether it worked.

I have an application which does something similar in a Unix setup.  It 
requires that the user runs two test applications at the same time -- either on 
the same computer or on two different computers.

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


[sqlite] File Locking And Concurrency In SQLite Version 3

2010-11-12 Thread Prakash Reddy Bande
Hello,

I want to use sqlite as a db on a shared network drive (windows) (user would 
map the network drive to say T:). I read the documentation section "File 
Locking And Concurrency In SQLite Version 3" 
(http://www.sqlite.org/lockingv3.html) 


Where following is clearly mentioned:
"SQLite uses POSIX advisory locks to implement locking on Unix. On Windows it 
uses the LockFile(), LockFileEx(), and UnlockFile() system calls. SQLite 
assumes that these system calls all work as advertised. If that is not the 
case, then database corruption can result. One should note that POSIX advisory 
locking is known to be buggy or even unimplemented on many NFS implementations 
(including recent versions of Mac OS X) and that there are reports of locking 
problems for network filesystems under Windows. Your best defense is to not use 
SQLite for files on a network filesystem."

My question: Is it possible to verify if the network drive on which the DB is 
place can be used? What I would like to do is when user tries to load the db 
(sqlite3_open) first run the verification and inform the user that database is 
placed on a drive that does not support the locking mechanism required by our 
product.

I am using sqlite-3.7.2

Regards,
 
Prakash Bande
Altair Engg. Inc. 
Troy MI
Ph: 248-614-2400 ext 489
Cell: 248-404-0292
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users