@@ -90,18 +90,19 @@ ;; 4. sync data to /tmp db (or update if exists) ;; 5. return dbstruct (if (hash-table-exists? areas area-path) (hash-table-ref areas area-path) (if (common:file-exists? (conc area-path "/megatest.config") quiet-mode: #t) - (let* ((homehost (common:minimal-get-homehost toppath)) + (let* ((homehost (common:minimal-get-homehost area-path)) (on-hh (common:on-host? homehost)) (mtconfig (common:simple-setup area-path)) ;; returns ( configdat toppath configfile configf-name ) (dbstruct (make-dbr:dbstruct area-path: area-path homehost: homehost configdat: (car mtconfig))) (tmpdb (db:open-db dbstruct area-path: area-path do-sync: #t))) + (hash-table-set! areas area-path dbstruct) tmpdb) (begin (debug:print-info 0 *default-log-port* "attempt to open megatest.db in " area-path " but no megatest.config found.") #f)))) @@ -2001,20 +2002,21 @@ ;; why get the keys from the db? why not get from the *configdat* ;; using keys:config-get-fields? (define (db:get-keys dbstruct) - (if *db-keys* *db-keys* + (if (dbr:dbstruct-keys dbstruct) + (dbr:dbstruct-keys dbstruct) (let ((res '())) (db:with-db dbstruct #f #f (lambda (db) (sqlite3:for-each-row (lambda (key) (set! res (cons key res))) db "SELECT fieldname FROM keys ORDER BY id DESC;"))) - (set! *db-keys* res) + (dbr:dbstruct-keys-set! dbstruct res) res))) ;; look up values in a header/data structure (define (db:get-value-by-header row header field) (if (or (null? header) (not row))