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/location.scm | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'guix-data-service/model/location.scm') diff --git a/guix-data-service/model/location.scm b/guix-data-service/model/location.scm index 9850377..6e010da 100644 --- a/guix-data-service/model/location.scm +++ b/guix-data-service/model/location.scm @@ -37,16 +37,17 @@ (define (location->location-id conn location) (match location (($ file line column) - (match (exec-query conn - select-existing-location - (list file - (number->string line) - (number->string column))) - (((id)) id) - (() - (caar - (exec-query conn - insert-location - (list file - (number->string line) - (number->string column))))))))) + (string->number + (match (exec-query conn + select-existing-location + (list file + (number->string line) + (number->string column))) + (((id)) id) + (() + (caar + (exec-query conn + insert-location + (list file + (number->string line) + (number->string column)))))))))) -- cgit v1.2.3