>On 9 May 2012, at 10:33am, <ext-esko.huja...@elektrobit.com> wrote:
 
>> 1: SAVEPOINT 1
>> 2: insert A
>> 3: RELEASE SAVEPOINT 1
 
>> 4: SAVEPOINT 2
>> 5: insert B
>> 6: ROLLBACK TO SAVEPOINT 2 
>> 
>> ROLLBACK in line 6 cancels also line 2 in addition to line 5.
>> 
>> I want to cancel just line 5.
 
>What it does depends on whether there's a 'BEGIN' before your step one,
but see
 
><http://www.sqlite.org/lang_savepoint.html>
 
>"The RELEASE of an inner transaction does not cause any changes to be
written 
>to the database file; it merely removes savepoints from the transaction
stack 
>such that it is no longer possible to ROLLBACK TO those savepoints."
 
>I think you want transactions, not rollbacks:
 
>1: BEGIN TRANSACTION
>2: insert A
>3: COMMIT TRANSACTION
 
>4: BEGIN TRANSACTION
>5: insert B
>6: ROLLBACK TRANSACTION
 
>Simon.w

 

Hi All,

 

Found a solution, so case is closed.

Solution was, that sequence needed a COMMIT at the end.

 

Real situation were a tad complex, but in principle, this works:

 

1: SAVEPOINT 1
2: insert A
3: RELEASE SAVEPOINT 1
4: SAVEPOINT 2
5: insert B
6: ROLLBACK TO SAVEPOINT 2
7: COMMIT
8: Dump the db to disk for inspecting with sqlitebrowser
 
Previously I was dumping in the db too early in the code,
and that caused confusion when inspecting.
 
But thanks Simon and Richard for your comments,
they showed that I was in the right track
(I'm a newbie in SQLite).

 

br, Esko



----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.

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

Reply via email to