aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2018-08-04 16:07:31 +0200
committerClément Lassieur <clement@lassieur.org>2018-08-04 16:31:34 +0200
commitd36ec7a3852772e2bac14f79ea9c2faa111b5d92 (patch)
treea2e0904b3b20cf6671cc0bfe5b1b26881ef152b7
parent99241ef1af24cadf39e3cad39f9ff27c96b22068 (diff)
downloadcuirass-d36ec7a3852772e2bac14f79ea9c2faa111b5d92.tar
cuirass-d36ec7a3852772e2bac14f79ea9c2faa111b5d92.tar.gz
database: Limit SQL queries to 80 columns.
-rw-r--r--src/cuirass/database.scm19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 56f421d..130a9c3 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -563,12 +563,21 @@ AND (:jobset IS NULL OR (:jobset = Specifications.name))
AND (:job IS NULL OR (:job = Derivations.job_name))
AND (:system IS NULL OR (:system = Derivations.system))
AND (:evaluation IS NULL OR (:evaluation = Builds.evaluation))
-AND (:status IS NULL OR (:status = 'done' AND Builds.status >= 0) OR (:status = 'pending' AND Builds.status < 0))
-AND (:borderlowtime IS NULL OR :borderlowid IS NULL OR ((:borderlowtime, :borderlowid) < (Builds.stoptime, Builds.id)))
-AND (:borderhightime IS NULL OR :borderhighid IS NULL OR ((:borderhightime, :borderhighid) > (Builds.stoptime, Builds.id)))
+AND (:status IS NULL OR (:status = 'done' AND Builds.status >= 0)
+ OR (:status = 'pending' AND Builds.status < 0))
+AND (:borderlowtime IS NULL OR :borderlowid IS NULL
+ OR ((:borderlowtime, :borderlowid) < (Builds.stoptime, Builds.id)))
+AND (:borderhightime IS NULL OR :borderhighid IS NULL
+ OR ((:borderhightime, :borderhighid) > (Builds.stoptime, Builds.id)))
ORDER BY
-CASE WHEN :borderlowtime IS NULL OR :borderlowid IS NULL THEN Builds.stoptime ELSE -Builds.stoptime END DESC,
-CASE WHEN :borderlowtime IS NULL OR :borderlowid IS NULL THEN Builds.id ELSE -Builds.id END DESC
+CASE WHEN :borderlowtime IS NULL
+ OR :borderlowid IS NULL THEN Builds.stoptime
+ ELSE -Builds.stoptime
+END DESC,
+CASE WHEN :borderlowtime IS NULL
+ OR :borderlowid IS NULL THEN Builds.id
+ ELSE -Builds.id
+END DESC
LIMIT :nr)
ORDER BY ~a, id ASC;" order))
(stmt (sqlite-prepare db stmt-text #:cache? #t)))