diff options
author | Munyoki Kilyungi | 2023-03-08 18:15:41 +0300 |
---|---|---|
committer | BonfaceKilz | 2023-04-05 16:17:11 +0300 |
commit | 77ef1e2f4733ff64cddf3b8cdf955cf4a21691f4 (patch) | |
tree | f9ced5f74d4e3bd0fd33ae0720f840f03bc8f23b | |
parent | 22a219367914425f8de39c93c442c81c06de95cd (diff) | |
download | gn-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-x | dump.scm | 6 | ||||
-rw-r--r-- | dump/sql.scm | 2 |
2 files changed, 6 insertions, 2 deletions
@@ -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)) |