Igor Tandetnik wrote:
> On 7/2/2014 3:04 AM, Clemens Ladisch wrote:
>>> If all else fails, one could try and simulate BEGIN IMMEDIATE by running
>>> a dummy modifying statement right after BEGIN - e.g.
>>>
>>> delete from table1 where 0;
>>
>> Would this be atomic?
>
> It would be part of the same transaction, wouldn't it?

In shared-cache mode, accesses from all threads are part of the same
transaction (as far as the database file is concerned).
SQL transactions are implemented on top of that.

> However, I have no reason to believe, other than your word, that BEGIN
> IMMEDIATE would not just work in this case. What makes you think it
> wouldn't?

In shared-cache mode,
| a transaction is implicitly a read-transaction until it first writes
| to a database table, at which point it becomes a write-transaction.
(http://www.sqlite.org/sharedcache.html)

There is no documented way to start a transaction with a write lock,
thus I see no mechanism that could reliably prevent deadlocks.


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

Reply via email to