database: Limit SQL queries to 80 columns.

This commit is contained in:
Clément Lassieur 2018-08-04 16:07:31 +02:00
parent 99241ef1af
commit d36ec7a385
No known key found for this signature in database
GPG Key ID: 89F96D4808F359C7
1 changed files with 14 additions and 5 deletions

View File

@ -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)))