From d3913a14d55968e505429693a6df6125e3468300 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 4 Sep 2019 19:24:22 +0200 Subject: Start handling ids as numbers, rather than strings squee, returns all data as strings, and expects strings as inputs to queries. So, keeping the ids as strings was easy initially, but it means that you can't tell from the type whether it should be quoted, or not... Therefore, handle ids as strings, converting them to numbers when they're fetched from the database, and back to strings as part of the queries. --- guix-data-service/model/git-repository.scm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'guix-data-service/model/git-repository.scm') diff --git a/guix-data-service/model/git-repository.scm b/guix-data-service/model/git-repository.scm index f460d0e..610dc49 100644 --- a/guix-data-service/model/git-repository.scm +++ b/guix-data-service/model/git-repository.scm @@ -41,17 +41,18 @@ conn (string-append "SELECT id FROM git_repositories WHERE url = '" url "'")))) - (match existing-id - (((id)) id) - (() - (caar - (exec-query conn - (string-append - "INSERT INTO git_repositories " - "(url) " - "VALUES " - "('" url "') " - "RETURNING id"))))))) + (string->number + (match existing-id + (((id)) id) + (() + (caar + (exec-query conn + (string-append + "INSERT INTO git_repositories " + "(url) " + "VALUES " + "('" url "') " + "RETURNING id")))))))) (define (guix-revisions-and-jobs-for-git-repository conn git-repository-id) (define query -- cgit v1.2.3