[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/18: Use insert-missing-data-and-return-all-ids for locations
From: |
Christopher Baines |
Subject: |
04/18: Use insert-missing-data-and-return-all-ids for locations |
Date: |
Mon, 16 Dec 2024 04:02:40 -0500 (EST) |
cbaines pushed a commit to branch master
in repository data-service.
commit 9a38374e7c27e41f592f457c53e1b187b08b7d59
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Fri Nov 29 13:47:40 2024 +0000
Use insert-missing-data-and-return-all-ids for locations
---
guix-data-service/model/location.scm | 38 +++++++++---------------------------
1 file changed, 9 insertions(+), 29 deletions(-)
diff --git a/guix-data-service/model/location.scm
b/guix-data-service/model/location.scm
index 6e010da..630251c 100644
--- a/guix-data-service/model/location.scm
+++ b/guix-data-service/model/location.scm
@@ -19,35 +19,15 @@
#:use-module (ice-9 match)
#:use-module (guix utils)
#:use-module (squee)
+ #:use-module (guix-data-service model utils)
#:export (location->location-id))
-(define select-existing-location
- (string-append
- "SELECT id "
- "FROM locations "
- "WHERE file = $1 AND line = $2 AND column_number = $3"))
-
-(define insert-location
- (string-append
- "INSERT INTO locations "
- "(file, line, column_number) VALUES "
- "($1, $2, $3) "
- "RETURNING id"))
-
(define (location->location-id conn location)
- (match location
- (($ <location> file line 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))))))))))
+ (car
+ (insert-missing-data-and-return-all-ids
+ conn
+ "locations"
+ '(file line column_number)
+ (match location
+ (($ <location> file line column)
+ (list (list file line column)))))))
- branch master updated (64aeeff -> 62d6b59), Christopher Baines, 2024/12/16
- 10/18: Fix wrong number of values from channel-derivations-by-system->guix-store-item, Christopher Baines, 2024/12/16
- 12/18: Fix hash display for formatted derivations, Christopher Baines, 2024/12/16
- 09/18: Rework loading revision data, Christopher Baines, 2024/12/16
- 06/18: Memoize field-can-be-null?, Christopher Baines, 2024/12/16
- 02/18: Move log message, Christopher Baines, 2024/12/16
- 15/18: Add a comment, Christopher Baines, 2024/12/16
- 13/18: Avoid getting the load-new-guix-revision-inserts lock twice, Christopher Baines, 2024/12/16
- 04/18: Use insert-missing-data-and-return-all-ids for locations,
Christopher Baines <=
- 14/18: Log differently when using the load-new-guix-revision-inserts lock, Christopher Baines, 2024/12/16
- 05/18: Handle conflicts when inserting lint warning message sets, Christopher Baines, 2024/12/16
- 18/18: Make build_servers.id just generated by default, Christopher Baines, 2024/12/16
- 11/18: Improve some query formatting, Christopher Baines, 2024/12/16
- 07/18: Handle conflicts in insert-missing-data-and-return-all-ids, Christopher Baines, 2024/12/16
- 08/18: Improve null handling, Christopher Baines, 2024/12/16
- 03/18: Add in call-with-worker-thread to try to avoid sort problems, Christopher Baines, 2024/12/16
- 17/18: Add utility functions for configuring the database, Christopher Baines, 2024/12/16
- 16/18: Use knots, Christopher Baines, 2024/12/16
- 01/18: Don't lookup #f in the hash table, Christopher Baines, 2024/12/16