Thanks Sinbad

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
This commit is contained in:
Drapersniper
2019-12-19 18:14:22 +00:00
parent 5ec8669c8b
commit 1cb3b64e4c

View File

@@ -44,15 +44,9 @@ PRAGMA temp_store = 2;
_PRAGMA_UPDATE_journal_mode = """ _PRAGMA_UPDATE_journal_mode = """
PRAGMA journal_mode = wal; PRAGMA journal_mode = wal;
""" """
_PRAGMA_UPDATE_wal_autocheckpoint = """
PRAGMA wal_autocheckpoint;
"""
_PRAGMA_UPDATE_read_uncommitted = """ _PRAGMA_UPDATE_read_uncommitted = """
PRAGMA read_uncommitted = 1; PRAGMA read_uncommitted = 1;
""" """
_PRAGMA_UPDATE_optimize = """
PRAGMA optimize = 1;
"""
_CREATE_TABLE = """ _CREATE_TABLE = """
CREATE TABLE IF NOT EXISTS playlists ( CREATE TABLE IF NOT EXISTS playlists (
@@ -173,7 +167,9 @@ VALUES
ON CONFLICT (scope_type, playlist_id, scope_id) DO ON CONFLICT (scope_type, playlist_id, scope_id) DO
UPDATE UPDATE
SET SET
playlist_name = excluded.playlist_name, playlist_url = excluded.playlist_url, tracks = excluded.tracks; playlist_name = excluded.playlist_name,
playlist_url = excluded.playlist_url,
tracks = excluded.tracks;
""" """
@@ -207,12 +203,10 @@ class Database:
self.cursor = self._database.cursor() self.cursor = self._database.cursor()
self.cursor.execute(_PRAGMA_UPDATE_temp_store) self.cursor.execute(_PRAGMA_UPDATE_temp_store)
self.cursor.execute(_PRAGMA_UPDATE_journal_mode) self.cursor.execute(_PRAGMA_UPDATE_journal_mode)
self.cursor.execute(_PRAGMA_UPDATE_wal_autocheckpoint)
self.cursor.execute(_PRAGMA_UPDATE_read_uncommitted) self.cursor.execute(_PRAGMA_UPDATE_read_uncommitted)
self.cursor.execute(_CREATE_TABLE) self.cursor.execute(_CREATE_TABLE)
def close(self): def close(self):
self.cursor.execute(_PRAGMA_UPDATE_optimize)
self._database.close() self._database.close()
@staticmethod @staticmethod