Is there a means for explicitly escalating an existing transaction from
RESERVED to EXCLUSIVE (either through issuing sql statements or the C
API)? 

I'm using the following locking strategy:
* Read only transactions start with a BEGIN and allow sqlite to escalate
to SHARED on read.
* Transactions that may (or are known to) write use BEGIN IMMEDIATE to
avoid the potential lock escalation issue that might occur with two
simultaneous SHARED transactions that each attempt to escalate to
RESERVED by issuing a read followed by a write.
* Install a busy handler that directs sqlite to continue trying to
obtain the lock. 

Unfortunately, I also have some transactions that I'd like to be
EXCLUSIVE.  In some cases, I know when beginning the transaction that
these should be EXCLUSIVE, and in some cases, I don't know until I'm
within the transaction that I'd like to be EXCLUSIVE.  Even in cases
where I know I'll eventually be exclusive, I'd like to delay exclusivity
as long as possible, allowing read operations to continue.  

Wwhat I'd like to do is begin this transaction BEGIN IMMEDIATE, allowing
SHARED locks to be acquired and the database read.  At some point within
the transaction, I'd like to force an escalation to EXCLUSIVE, forcing
all SHARED and other locks to clear before continuing.

Is there a way to do this?

Thanks!

Pat

Reply via email to