guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: Format some queries generated in insert-missing-data-and-return-a


From: Christopher Baines
Subject: 02/03: Format some queries generated in insert-missing-data-and-return-all-ids
Date: Thu, 15 Sep 2022 04:59:09 -0400 (EDT)

cbaines pushed a commit to branch master
in repository data-service.

commit d791c2bd8a53607b4b0e8db33edc3f21fdcf97a3
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Wed Sep 14 15:42:16 2022 +0100

    Format some queries generated in insert-missing-data-and-return-all-ids
---
 guix-data-service/model/utils.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/guix-data-service/model/utils.scm 
b/guix-data-service/model/utils.scm
index b11cee5..4a0e5d8 100644
--- a/guix-data-service/model/utils.scm
+++ b/guix-data-service/model/utils.scm
@@ -196,11 +196,11 @@ WHERE table_name = $1"
 
   (define select-query
     (string-append
-     "SELECT id, "
+     "SELECT id,\n"
      (string-join (map (lambda (field)
                          (string-append table-name "." field))
                        field-strings)
-                  ", ")
+                  ",\n")
      " FROM " table-name
      " JOIN (VALUES "
      (string-join
@@ -215,7 +215,7 @@ WHERE table_name = $1"
             (concatenate data))
            data))
       ", ")
-     ") AS vals (" (string-join field-strings ", ") ") "
+     ")\n  AS vals (" (string-join field-strings ", ") ") "
      "ON "
      (string-join
       (map (lambda (field)
@@ -229,7 +229,7 @@ WHERE table_name = $1"
                       '())
                 ")")))
            field-strings)
-      " AND ")))
+      " AND\n  ")))
 
   (define (temp-table-select-query temp-table-name)
     (string-append
@@ -261,8 +261,8 @@ WHERE table_name = $1"
                        #:key
                        (table-name table-name))
     (string-append
-     "INSERT INTO " table-name " ("
-     (string-join field-strings ", ")
+     "INSERT INTO " table-name " (\n"
+     (string-join field-strings ",\n")
      ") VALUES "
      (string-join
       (map (lambda (field-values)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]