On 04/08/2015 10:52 PM, R.Smith wrote:
>
>
> On 2015-04-08 05:38 PM, Dan Kennedy wrote:
>> On 04/08/2015 09:51 PM, R.Smith wrote:
>>>
>>>
>>> On 2015-04-08 04:18 PM, Fabian Pr?bstl wrote:
>>>> Hi there!
>>>>
>>>> Currently, we are using SQLite as our application file format for a 
>>>> Windows 7/C#/System.Data.SQLite based desktop application. We only 
>>>> allow one instance to open the file by running "set 
>>>> locking_mode=EXCLUSIVE;BEGIN EXCLUSIVE;COMMIT" when connecting to 
>>>> the database.
>>>
>>> BEGIN EXCLUSIVE - Locks the database from other SQLite3 database 
>>> connections for the time being.
>>> COMMIT; - Unlocks it again - so calling all this in one go is 
>>> pointless.
>>
>> Almost always correct. But the "PRAGMA locking_mode=EXCLUSIVE" thing 
>> changes the behaviour:
>>
>>   https://www.sqlite.org/pragma.html#pragma_locking_mode
>
> But you need an actual SELECT to get a shared lock and an actual write 
> operation to lock it exclusively, just starting the transaction and 
> ending it does nothing to that effect? Or is my understanding wrong?

That's the usual case. But "BEGIN EXCLUSIVE" actually does take an 
exclusive lock:

   https://www.sqlite.org/lang_transaction.html


Reply via email to