56  TCL (Transactional control language)

sqlite Transaction

56.1 Transaction Demo 1

show rollback

BEGIN TRANSACTION;
INSERT INTO Playlist (PlaylistId, Name) VALUES(0, '');
select * from Playlist;
ROLLBACK TRANSACTION;

show commit;

BEGIN TRANSACTION;
INSERT INTO Playlist (PlaylistId, Name) VALUES(0, '');
select * from Playlist;
ROLLBACK TRANSACTION;

56.2 Transaction Demo 2

Demo: 2 command line, show

  • Show if another session could insert to same table;
  • Show if another session could insert to another table;