aboutsummaryrefslogtreecommitdiff
path: root/dump.scm
diff options
context:
space:
mode:
authorArun Isaac2021-12-23 16:39:34 +0530
committerArun Isaac2021-12-23 16:39:34 +0530
commit89860aa90fe30f390d5914a3b7fbd4691ebfd282 (patch)
tree1e500086fdc71d6ae250993bf626ad954f4899c0 /dump.scm
parentf42696cc2186b143adc92eb494ecbc14f8d0c203 (diff)
downloadgn-transform-databases-89860aa90fe30f390d5914a3b7fbd4691ebfd282.tar.gz
Do not register dumped tables and columns to %dumped.
* dump.scm (%dumped): Delete variable. (define-dump): Do not register dumped tables and columns to %dumped. (dumped-table?): Delete function.
Diffstat (limited to 'dump.scm')
-rwxr-xr-xdump.scm53
1 files changed, 17 insertions, 36 deletions
diff --git a/dump.scm b/dump.scm
index 7515c6d..90abe5e 100755
--- a/dump.scm
+++ b/dump.scm
@@ -197,7 +197,6 @@ ALIST field-name) forms."
key))))
clauses))
-(define %dumped '())
(define-syntax define-dump
(lambda (x)
@@ -210,32 +209,23 @@ ALIST field-name) forms."
(syntax-case triples-clause (triples)
((triples subject predicates ...)
(let ((fields (collect-fields #'(subject predicates ...))))
- #`(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)
- #,(syntax-case schema-triples-clause (schema-triples)
- ((schema-triples (triple-subject triple-predicate triple-object) ...)
- #`(for-each triple
- (list 'triple-subject ...)
- (list 'triple-predicate ...)
- (list 'triple-object ...)))
- (_ (error "Invalid schema triples clause:" schema-triples-clause)))
- (sql-for-each (lambda (row)
- (scm->triples
- (map-alist row #,@(field->key #'(predicates ...)))
- #,(field->assoc-ref #'row #'subject)))
- db
- #,(syntax-case tables-clause (tables)
- ((tables tables-spec raw ...)
- #`(select-query #,fields tables-spec raw ...))
- (_ (error "Invalid tables clause:" (syntax->datum tables-clause)))))))))
+ #`(define (name db)
+ #,(syntax-case schema-triples-clause (schema-triples)
+ ((schema-triples (triple-subject triple-predicate triple-object) ...)
+ #`(for-each triple
+ (list 'triple-subject ...)
+ (list 'triple-predicate ...)
+ (list 'triple-object ...)))
+ (_ (error "Invalid schema triples clause:" schema-triples-clause)))
+ (sql-for-each (lambda (row)
+ (scm->triples
+ (map-alist row #,@(field->key #'(predicates ...)))
+ #,(field->assoc-ref #'row #'subject)))
+ db
+ #,(syntax-case tables-clause (tables)
+ ((tables tables-spec raw ...)
+ #`(select-query #,fields tables-spec raw ...))
+ (_ (error "Invalid tables clause:" (syntax->datum tables-clause))))))))
(_ (error "Invalid triples clause:" triples-clause)))))
(_ (error "Invalid define-dump syntax:" (syntax->datum x))))))
@@ -602,15 +592,6 @@ is a <table> object."
(information_schema.tables)
(format #f "WHERE table_schema = '~a'" %database-name)))))
-(define (dumped-table? table)
- "Return non-#f if TABLE has been dumped. Else, return #f."
- (any (match-lambda
- ((dumped-table . _)
- (string=? (symbol->string dumped-table)
- (table-name table)))
- (x (error "Malformed entry in %dumped:" x)))
- %dumped))
-
(define (dump-schema db)
(let ((tables (tables db)))
(for-each (lambda (table)