159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
-
-
+
+
-
-
-
+
-
-
-
-
-
+
+
-
-
+
+
+
+
|
;; if run-id is a string treat it as a filename
;; if db already open - return inmem
;; if db not open, open inmem, rundb and sync then return inmem
;; inuse gets set automatically for rundb's
;;
;; (define db:get-db db:get-subdb)
;; (define (db:get-db subdb #;dbstruct run-id) ;; RENAME TO db:get-dbh
;; ;; (let* ((subdb (dbfile:get-subdb dbstruct run-id)))
(define (db:get-db dbstruct run-id)
(let* ((subdb (dbfile:get-subdb dbstruct run-id))
;; (if (stack? (dbr:subdb-dbstack subdb))
;; (if (stack-empty? (dbr:subdb-dbstack subdb))
;; (let* ((dbname (db:run-id->dbname run-id))
(dbdat (dbfile:get-dbdat dbstruct run-id)))
;; (newdb (db:open-megatest-db path: (db:dbfile-path)
;; name: dbname)))
;; ;; NOTE: pushing on the stack only happens AFTER the handle has been used
;; ;; (stack-push! (dbr:dbstruct-dbstack dbstruct) newdb)
;; newdb)
(if (dbr:dbdat? dbdat)
dbdat
;; (stack-pop! (dbr:subdb-dbstack subdb)))
;; (db:open-db subdb run-id))) ;; )
(dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db)
)
)
)
(define-inline (db:generic-error-printout exn . message)
(print-call-chain (current-error-port))
(apply debug:print-error 0 *default-log-port* message)
(debug:print-error 0 *default-log-port* " params: " params
", error: " ((condition-property-accessor 'exn 'message) exn)
", arguments: " ((condition-property-accessor 'exn 'arguments) exn)
|