diff options
author | Michaël Ball <michael.ball@gmail.com> | 2015-08-09 14:44:55 +0100 |
---|---|---|
committer | Michaël Ball <michael.ball@gmail.com> | 2015-08-09 14:44:55 +0100 |
commit | 6b5c87d5c35ebbac6f7fbcac1a722bd0b3148e04 (patch) | |
tree | efc2b776dad1307d4b8b78a517e9789852b4dc31 /models/album.py | |
parent | 122ec1c9b283776b8f1fea5559d4317bdba5b977 (diff) |
Improve performance - introduce transactions
Diffstat (limited to 'models/album.py')
-rw-r--r-- | models/album.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/models/album.py b/models/album.py index b2625db..216b615 100644 --- a/models/album.py +++ b/models/album.py @@ -24,6 +24,8 @@ class Album(): for track in self.tracks: track.delete() + cursor.execute("BEGIN TRANSACTION") + delete_sql = "DELETE FROM album WHERE id = ?" cursor.execute(delete_sql, (self.id,)) @@ -33,6 +35,8 @@ class Album(): delete_artist_rel_sql = "DELETE FROM album_artist WHERE album_id = ?" cursor.execute(delete_artist_rel_sql, (self.id,)) + cursor.execute("COMMIT TRANSACTION") + return True @property |