Hi Jean-Luc,

All your problem is that you must use conn.isolation_level = None
With conn.isolation_level = "" , the default of sqlite3, nothing related
with transaction will work.

Just try with :
* this program :
https://github.com/stonebig/sqlite_bro/blob/master/sqlite_bro.py
(or pip install sqlite_bro)

* your example slightly reworked :

-- use conn.isolation_level = None , when you want to manipulate
transactions
drop table if exists PERSON;
create table PERSON (PID char(4),Name char(10));
insert into PERSON values ('p1','Smith'),('p2','Dermiez');

BEGIN TRANSACTION;
-- We check the contents of table PERSON
select * from PERSON;

-- We insert Jones and we check the contents of PERSON
insert into PERSON values('p3','Jones');
select * from PERSON;

-- We execute a simple "with" query
with CTE(A) as (values (1),(2)) select A from CTE;

-- We cancel the last insertion (Jones should disappear)
-- and we check the contents of PERSON
ROLLBACK;
select * from PERSON;

-- No Surprise: Jones IS NO MORE in the DB
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to