Thanks Keith for your followup, I see my answer to Clemens helped focus what 
I'm on. :)

> Le 13 avr. 2017 à 16:11, Keith Medcalf <kmedc...@dessus.com> a écrit :
> 
> You use the sqlite3_autocommit() to determine if you are in "magical" mode or 
> inside a transaction.

Hmm.  I failed to spot sqlite3_get_autocommit() as a way to detect if I have an 
explicit transaction or not.  Thanks for popping it up here!  It alleviates the 
need to pass on that information from caller to callee in those cases where it 
is needed.

> If you are in "magical" mode then you need to issue an appropriate BEGIN to 
> begin a transaction (with options such as IMMEDIATE if you want).  Though, 
> how do you know when you are done (as in COMMIT).

If some utility method is called without an explicit transaction setup and the 
work to be done needs atomicity, then the utility method can do its own BEGIN 
IMMEDIATE (that's what I need in those cases) _and_ COMMIT.  Clearly in that 
case, the caller didn't care for a greater context, else it would have 
explicitly started a transaction before (and in my use case that would have 
been an IMMEDIATE one).

Merely coding a:

SAVEPOINT svpt IMMEDIATE;
...
RELEASE svpt;

(if it existed) would be much more simple in those cases, instead of detecting 
(by any means) if there is a proper explicit outer transaction and locally do 
or not do BEGIN IMMEDIATE ... COMMIT.  That was pretty much all I was after. :)

Thanks,
-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia, http://integral.software


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

Reply via email to