aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-03-08 18:15:41 +0300
committerBonfaceKilz2023-04-05 16:17:11 +0300
commit77ef1e2f4733ff64cddf3b8cdf955cf4a21691f4 (patch)
treef9ced5f74d4e3bd0fd33ae0720f840f03bc8f23b
parent22a219367914425f8de39c93c442c81c06de95cd (diff)
downloadgn-transform-databases-77ef1e2f4733ff64cddf3b8cdf955cf4a21691f4.tar.gz
Add ability to have operations such as GROUP_CONCAT in SELECT clause
This change enables having: "... GROUP_CONCAT(GeneRIF_BASIC.PubMedId) AS alias ..." as part of the query. * dump.scm (field->key, field->assoc-ref): Add new syntax-rule. * dump/sql.scm (select-query): Ditto. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rwxr-xr-xdump.scm6
-rw-r--r--dump/sql.scm2
2 files changed, 6 insertions, 2 deletions
diff --git a/dump.scm b/dump.scm
index 784dd15..3ae1dd1 100755
--- a/dump.scm
+++ b/dump.scm
@@ -126,7 +126,8 @@ association list mapping substrings to their replacements."
(syntax->datum
((syntax-rules (field)
((field table column) column)
- ((field table column alias) alias))
+ ((field table column alias) alias)
+ ((field table column operation alias) alias))
x)))))
x))
@@ -140,7 +141,8 @@ ALIST field-name) forms."
(syntax->datum
((syntax-rules (field)
((field table column) column)
- ((field table column alias) alias))
+ ((field table column alias) alias)
+ ((field table column operation alias) alias))
x)))))
x))
diff --git a/dump/sql.scm b/dump/sql.scm
index 74f3139..54371a2 100644
--- a/dump/sql.scm
+++ b/dump/sql.scm
@@ -33,6 +33,8 @@
(format #f "~a.~a" table column))
((table column alias)
(format #f "~a.~a AS ~a" table column alias))
+ ((table column operation alias)
+ (format #f "~a(~a.~a) AS ~a" operation table column alias))
(field-spec
(error "Invalid field specification" field-spec)))
(syntax->datum #'fields))