branch: master commit d36ec7a3852772e2bac14f79ea9c2faa111b5d92 Author: Clément Lassieur <clem...@lassieur.org> Date: Sat Aug 4 16:07:31 2018 +0200
database: Limit SQL queries to 80 columns. --- src/cuirass/database.scm | 19 ++++++++++++++----- 1 file 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)))