On 3-3-2019 15:33, Simon Slavin wrote:
On 3 Mar 2019, at 2:29pm, Luuk <luu...@gmail.com> wrote:
Conclusion: RESTORE does not end TRANSACTION ?
Your statement is correct. However, RESTORE is a partner of SAVEPOINT. My
question does not consider SAVEPOINTs.
Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Something like this (SAVEPOINT/RELEASE):
sqlite> DELETE FROM test WHERE i>=11;
sqlite> .dump test
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE test(i int primary key);
INSERT INTO test VALUES(1);
INSERT INTO test VALUES(2);
INSERT INTO test VALUES(3);
INSERT INTO test VALUES(4);
INSERT INTO test VALUES(10);
COMMIT;
sqlite>
sqlite> BEGIN;
sqlite> SAVEPOINT point1;
sqlite> INSERT INTO test VALUES (10);
Error: UNIQUE constraint failed: test.i
sqlite> RELEASE point1;
sqlite> INSERT INTO test VALUES (11);
sqlite> INSERT INTO test VALUES (12);
sqlite> END;
sqlite> SELECT * FROM test;
1
2
3
4
10
11
12
sqlite>
Something like this (NO SAVEPOINT/RELEASE):
sqlite> DELETE FROM test WHERE i>=11;
sqlite> .dump test
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE test(i int primary key);
INSERT INTO test VALUES(1);
INSERT INTO test VALUES(2);
INSERT INTO test VALUES(3);
INSERT INTO test VALUES(4);
INSERT INTO test VALUES(10);
COMMIT;
sqlite>
sqlite> BEGIN;
sqlite>
sqlite> INSERT INTO test VALUES (10);
Error: UNIQUE constraint failed: test.i
sqlite> RELEASE point1;
Error: no such savepoint: point1
sqlite> INSERT INTO test VALUES (11);
sqlite> ROLLBACK;
sqlite> INSERT INTO test VALUES (12);
sqlite> END;
Error: cannot commit - no transaction is active
sqlite> SELECT * FROM test;
1
2
3
4
10
12
sqlite>
Record '11' is missing, seems OK because off ROLLBACK
But i'am a bit confused about the error "Error: cannot commit - no
transaction is active"
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users