aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-data-service/comparison.scm13
-rw-r--r--guix-data-service/database.scm14
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm3
-rw-r--r--guix-data-service/model/derivation.scm46
-rw-r--r--guix-data-service/model/git-branch.scm6
-rw-r--r--guix-data-service/model/git-repository.scm9
6 files changed, 53 insertions, 38 deletions
diff --git a/guix-data-service/comparison.scm b/guix-data-service/comparison.scm
index 470c14e..dbccb81 100644
--- a/guix-data-service/comparison.scm
+++ b/guix-data-service/comparison.scm
@@ -548,7 +548,8 @@ ORDER BY coalesce(base_packages.name, target_packages.name) ASC, base_packages.v
(define (package-data->package-data-vhashes package-data)
(define (add-data-to-vhash data vhash)
(let ((key (first data)))
- (if (string-null? key)
+ (if (or (eq? #f key)
+ (string-null? key))
vhash
(vhash-cons key
(drop data 1)
@@ -567,7 +568,8 @@ ORDER BY coalesce(base_packages.name, target_packages.name) ASC, base_packages.v
(define (package-derivation-data->package-derivation-data-vhashes package-data)
(define (add-data-to-vhash data vhash)
(let ((key (first data)))
- (if (string-null? key)
+ (if (or (eq? key #f)
+ (string-null? key))
vhash
(vhash-cons key
(drop data 1)
@@ -600,7 +602,8 @@ ORDER BY coalesce(base_packages.name, target_packages.name) ASC, base_packages.v
'()
(map (match-lambda
((base-name base-version _ _ _ _ _ target-name target-version _ _ _ _ _)
- (if (string-null? base-name)
+ (if (or (and (string? base-name) (string-null? base-name))
+ (eq? base-name #f))
(cons target-name target-version)
(cons base-name base-version))))
package-data))))
@@ -733,7 +736,9 @@ ORDER BY coalesce(base_packages.name, target_packages.name) ASC, base_packages.v
`((system . ,system)
(target . ,target)
(derivation-file-name . ,derivation-file-name)
- (builds . ,(if (string-null? builds)
+ (builds . ,(if (or (and (string? builds)
+ (string-null? builds))
+ (eq? #f builds))
#()
(json-string->scm builds))))))
,@(derivation-system-and-target-list->alist (cdr lst)))))
diff --git a/guix-data-service/database.scm b/guix-data-service/database.scm
index cf151c9..546c678 100644
--- a/guix-data-service/database.scm
+++ b/guix-data-service/database.scm
@@ -191,12 +191,14 @@
(map
(lambda (col-i)
(let ((val (result-get-value result-ptr row-i col-i)))
- (if (string-null? val)
- (if (eq? 1 (%PQgetisnull
- (squee/unwrap-result-ptr result-ptr) row-i col-i))
- '()
- val)
- val)))
+ (cond
+ ((eq? #f val) '())
+ ((string-null? val)
+ (if (eq? 1 (%PQgetisnull
+ (squee/unwrap-result-ptr result-ptr) row-i col-i))
+ '()
+ val))
+ (else val))))
cols-range))
rows-range)))
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index ab6e2db..e369ad5 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -1587,7 +1587,8 @@ ORDER BY load_new_guix_revision_jobs.id DESC")
((id source git-repository-id created-at succeeded-at
events-json log-exists?)
(list id commit source git-repository-id created-at succeeded-at
- (if (string-null? events-json)
+ (if (or (eq? #f events-json)
+ (string-null? events-json))
#()
(json-string->scm events-json))
(string=? log-exists? "t"))))
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm
index 8a299be..22986f8 100644
--- a/guix-data-service/model/derivation.scm
+++ b/guix-data-service/model/derivation.scm
@@ -360,7 +360,8 @@ ORDER BY derivations.file_name
(list file_name
system
target
- (if (string-null? builds)
+ (if (or (and (string? builds) (string-null? builds))
+ (eq? #f builds))
#()
(json-string->scm builds))))
((file_name system target)
@@ -553,7 +554,8 @@ ORDER BY derivations.file_name
(list file_name
system
target
- (if (string-null? builds)
+ (if (or (and (string? builds) (string-null? builds))
+ (eq? #f builds))
#()
(json-string->scm builds)))))
(exec-query conn
@@ -643,26 +645,26 @@ LIMIT $4"))
(map (match-lambda
((derivation_file_name latest_build)
`((derivation_file_name . ,derivation_file_name)
- (latest_build . ,(if
- (string-null? latest_build)
- 'null
- (map (match-lambda
- ((key . value)
- (cons (string->symbol key)
- value)))
- (json-string->scm latest_build)))))))
- (exec-query conn
- query
- `(,commit
- ,system
- ,target
- ,(number->string (or limit-results 999999)) ; TODO
- ,@(if after-derivation-file-name
- (list after-derivation-file-name)
- '())
- ,@(if latest-build-status
- (list latest-build-status)
- '())))))
+ (latest_build . ,(if latest_build
+ (map (match-lambda
+ ((key . value)
+ (cons (string->symbol key)
+ value)))
+ (json-string->scm latest_build))
+ 'null)))))
+ (exec-query-with-null-handling
+ conn
+ query
+ `(,commit
+ ,system
+ ,target
+ ,(number->string (or limit-results 999999)) ; TODO
+ ,@(if after-derivation-file-name
+ (list after-derivation-file-name)
+ '())
+ ,@(if latest-build-status
+ (list latest-build-status)
+ '())))))
(define* (select-derivation-outputs-in-revision conn
commit-hash
diff --git a/guix-data-service/model/git-branch.scm b/guix-data-service/model/git-branch.scm
index 19e0ccc..070931d 100644
--- a/guix-data-service/model/git-branch.scm
+++ b/guix-data-service/model/git-branch.scm
@@ -105,7 +105,8 @@ WHERE git_branches.commit = $1")
(list commit
datetime
(string=? guix_revision_exists "t")
- (if (string=? job_events "")
+ (if (or (and (string? job_events) (string-null? job_events))
+ (eq? #f job_events))
'()
(vector->list (json-string->scm job_events))))))
(exec-query
@@ -161,7 +162,8 @@ ORDER BY name, datetime DESC"))
commit
datetime
(string=? guix_revision_exists "t")
- (if (string=? job_events "")
+ (if (or (and (string? job_events) (string=? job_events ""))
+ (eq? #f job_events))
'()
(vector->list (json-string->scm job_events))))))
(exec-query
diff --git a/guix-data-service/model/git-repository.scm b/guix-data-service/model/git-repository.scm
index 4eeb99d..9db682e 100644
--- a/guix-data-service/model/git-repository.scm
+++ b/guix-data-service/model/git-repository.scm
@@ -75,10 +75,12 @@ FROM git_repositories WHERE id = $1"
(list (number->string id)))
(((included_branches excluded_branches))
(values
- (if (string=? included_branches "")
+ (if (or (eq? #f included_branches)
+ (string-null? included_branches))
'()
(parse-postgresql-array-string included_branches))
- (if (string=? excluded_branches "")
+ (if (or (eq? excluded_branches #f)
+ (string-null? excluded_branches))
'()
(parse-postgresql-array-string excluded_branches))))))
@@ -144,7 +146,8 @@ ORDER BY 1 DESC NULLS FIRST, 2 DESC LIMIT 10;")
((id job_id job_events commit source)
(list id
job_id
- (if (string=? "" job_events)
+ (if (or (eq? #f job_events)
+ (string-null? job_events))
'()
(vector->list (json-string->scm job_events)))
commit source)))