[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/18: Improve some query formatting
From: |
Christopher Baines |
Subject: |
11/18: Improve some query formatting |
Date: |
Mon, 16 Dec 2024 04:02:41 -0500 (EST) |
cbaines pushed a commit to branch master
in repository data-service.
commit 5664cde17cfd8acbdfcea8ebe1d364ed287c9e5a
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sat Dec 7 12:30:04 2024 +0000
Improve some query formatting
---
guix-data-service/model/utils.scm | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/guix-data-service/model/utils.scm
b/guix-data-service/model/utils.scm
index 0c2cb72..cd59681 100644
--- a/guix-data-service/model/utils.scm
+++ b/guix-data-service/model/utils.scm
@@ -277,22 +277,20 @@ JOIN (VALUES "
(define query
(string-append
"
-INSERT INTO " table-name " (\n"
-(string-join field-strings ",\n")
-") VALUES "
-(string-join
- (map (lambda (field-values)
- (string-append
- "("
- (string-join
- (map (lambda (value)
- (value->sql value))
- field-values)
- ", ")
- ")"))
- data)
- ", ")
-" ON CONFLICT DO NOTHING
+INSERT INTO " table-name " (" (string-join field-strings ", ") ") VALUES
+" (string-join
+ (map (lambda (field-values)
+ (string-append
+ "("
+ (string-join
+ (map (lambda (value)
+ (value->sql value))
+ field-values)
+ ", ")
+ ")"))
+ data)
+ ", ") "
+ON CONFLICT DO NOTHING
RETURNING id"))
(if (null? data)
@@ -428,7 +426,7 @@ WHERE "
(define insert
(string-append
"
-INSERT INTO " table-name " (\n" (string-join field-strings ",\n") ")
+INSERT INTO " table-name " (" (string-join field-strings ", ") ")
VALUES (" (string-join
(map (lambda (i)
(simple-format #f "$~A" i))
- 12/18: Fix hash display for formatted derivations, (continued)
- 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, 2024/12/16
- 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 <=
- 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