From 85fd926e3d8bc4d0d50acc115bb028b105d0feb1 Mon Sep 17 00:00:00 2001 From: Elliu <goyard.louis@gmail.com> Date: Sun, 9 Aug 2020 20:13:49 +0200 Subject: [PATCH] Moving queue_tmp to permanent table to fix the __queue_reorder crash --- .gitignore | 3 +++ PKGBUILD | 2 +- src/database/disk.sql | 7 +++++++ src/database/queue.c | 6 ------ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 3f6f2bef..96b27b15 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ cscope.files cscope.out tags !*.inc +*.zst +config.log +autom4te.cache diff --git a/PKGBUILD b/PKGBUILD index 0a4537fb..ef2513a5 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Maël 'Kubat' MARTIN <mael.martin31@gmail.com> pkgname=lektor -pkgver=mk7.1036.462cf03 +pkgver=mk7.1044.1d6ed7d pkgrel=1 pkgdesc="The lektor kara player, from the Bakaclub" arch=(x86_64 i686) diff --git a/src/database/disk.sql b/src/database/disk.sql index d1e356f6..53a0d37f 100644 --- a/src/database/disk.sql +++ b/src/database/disk.sql @@ -77,6 +77,13 @@ CREATE TABLE IF NOT EXISTS queue , priority INTEGER NOT NULL DEFAULT 1 CHECK(priority > 0 AND priority < 6) ); +-- Temporary queue table used when reorderingg the queue (for inserts) +CREATE TEMPORARY TABLE queue_tmp IF NOT EXISTS + ( position INTEGER PRIMARY KEY AUTOINCREMENT CHECK(position > 0) + , kara_id INTEGER + , priority INTEGER NOT NULL DEFAULT 1 CHECK(priority > 0 AND priority < 6) + ); + -- The user table -- Used for the [password {passwd}] MPD command. The documentation can be found diff --git a/src/database/queue.c b/src/database/queue.c index 9762414c..be228d71 100644 --- a/src/database/queue.c +++ b/src/database/queue.c @@ -132,12 +132,6 @@ __queue_reorder(volatile sqlite3 *db) "(SELECT CASE WHEN (SELECT current FROM queue_state) IS NULL THEN 0" \ " ELSE (SELECT current FROM queue_state) END AS val LIMIT 1)" static const char *SQL_REORDER = - /* Create temporary tables */ - "CREATE TEMPORARY TABLE queue_tmp IF NOT EXISTS" - " ( position INTEGER PRIMARY KEY AUTOINCREMENT CHECK(position > 0)" - " , kara_id INTEGER" - " , priority INTEGER NOT NULL DEFAULT 1 CHECK(priority > 0 AND priority < 6)" - " );" /* Separate karas that are after the current one */ "INSERT INTO queue_tmp (kara_id, priority)" " SELECT kara_id, priority FROM queue WHERE position > " CURRENT_POS_OR_0 -- GitLab