about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2021-12-23 16:43:59 +0530
committerArun Isaac2021-12-23 16:43:59 +0530
commit3aff5fa35efd8437acaf8bea33285ba8ab298a5c (patch)
treee663fb423712ee64f7de8945f369149f921c77f8
parent89860aa90fe30f390d5914a3b7fbd4691ebfd282 (diff)
downloadgn-transform-databases-3aff5fa35efd8437acaf8bea33285ba8ab298a5c.tar.gz
Abstract column id generation to separate function.
* dump.scm (column-id): New function.
(dump-schema): Use column-id.
-rwxr-xr-xdump.scm8
1 files changed, 5 insertions, 3 deletions
diff --git a/dump.scm b/dump.scm
index 90abe5e..5be830a 100755
--- a/dump.scm
+++ b/dump.scm
@@ -197,6 +197,9 @@ ALIST field-name) forms."
                   key))))
         clauses))
 
+(define (column-id table-name column-name)
+  (string->identifier
+   "field" (string-append table-name "__" column-name)))
 
 (define-syntax define-dump
   (lambda (x)
@@ -600,9 +603,8 @@ is a <table> object."
                   (triple table-id 'gn:name (table-name table))
                   (triple table-id 'gn:hasSize (table-size table))
                   (for-each (lambda (column)
-                              (let ((column-id (string->identifier
-                                                "field" (string-append (table-name table)
-                                                                       "__" (column-name column)))))
+                              (let ((column-id (column-id (table-name table)
+                                                          (column-name column))))
                                 (triple column-id 'rdf:type 'gn:sqlTableField)
                                 (triple column-id 'gn:name (column-name column))
                                 (triple column-id 'gn:sqlFieldType (column-type column))