diff options
author | Arun Isaac | 2021-12-11 16:38:24 +0530 |
---|---|---|
committer | Arun Isaac | 2021-12-11 16:38:24 +0530 |
commit | 14381f313b1ca871f3516931f477b232b35b3545 (patch) | |
tree | 874d12c418a646d3451690385e4422fbc80e129a | |
parent | 834c2429857e97f9e13dde4bd846cf5793f73e37 (diff) | |
download | gn-transform-databases-14381f313b1ca871f3516931f477b232b35b3545.tar.gz |
Log dumped tables and columns.
* dump.scm (%dumped): New variable.
(define-dump): Append to %dumped when a new table dumping function is
defined.
-rwxr-xr-x | dump.scm | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -143,12 +143,23 @@ characters with an underscore and prefixing with gn:PREFIX." (define (triple subject predicate object) (format #t "~a ~a ~s .~%" subject predicate object)) +(define %dumped '()) + (define-syntax define-dump (lambda (x) (syntax-case x (select-query) ((_ name (select-query (fields ...) tables raw-forms ...) proc) - (define (name db) - (sql-for-each proc db (select-query (fields ...) tables raw-forms ...))))))) + #`(begin + (set! %dumped + (append (list #,@(filter-map (lambda (field) + (syntax-case field (distinct) + (distinct #f) + ((table column _ ...) #'(cons 'table 'column)) + (field-spec (error "Invalid field specification" #'field-spec)))) + #'(fields ...))) + %dumped)) + (define (name db) + (sql-for-each proc db (select-query (fields ...) tables raw-forms ...)))))))) (define binomial-name->species-id (cut string->identifier "species" <>)) |