Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -28,14 +28,14 @@ ezsteps.scm lock-queue.scm sdb.scm rmt.scm api.scm \ subrun.scm portlogger.scm archive.scm env.scm \ diff-report.scm cgisetup/models/pgdb.scm # module source files -MSRCFILES = dbmod.scm dbfile.scm # debugprint.scm mtargs.scm +MSRCFILES = dbmod.scm dbfile.scm debugprint.scm mtargs.scm -# mofiles/dbfile.o : mofiles/debugprint.o -# mofiles/debugprint.o : mofiles/mtargs.o +mofiles/dbfile.o : mofiles/debugprint.o +mofiles/debugprint.o : mofiles/mtargs.o # ftail.scm rmtmod.scm commonmod.scm removed # MSRCFILES = ducttape-lib.scm pkts.scm stml2.scm cookie.scm mutils.scm \ # mtargs.scm commonmod.scm dbmod.scm adjutant.scm ulex.scm \ # rmtmod.scm apimod.scm Index: dbfile.scm ================================================================== --- dbfile.scm +++ dbfile.scm @@ -155,10 +155,14 @@ (cond ((number? run-id) (conc ".db/" (modulo run-id 100) ".db")) ((not run-id) (conc ".db/main.db")) (else run-id))) +(define (dbfile:get-subdb dbstruct run-id) + (let* ((dbfname (db:run-id->dbname run-id))) + (hash-table-ref/default (dbr:dbstruct-subdbs dbstruct) dbfname #f))) + ;; Get/open a database ;; if run-id => get run specific db ;; if #f => get main db ;; if run-id is a string treat it as a filename ;; if db already open - return inmem @@ -171,13 +175,13 @@ (if (stack-empty? (dbr:subdb-dbstack subdb)) #f (stack-pop! (dbr:subdb-dbstack subdb))) #f))) -(define (dbfile:add-dbh dbstruct run-id db) +(define (dbfile:add-dbh dbstruct run-id dbh) (let* ((subdb (dbfile:get-subdb dbstruct run-id))) (if (not (stack? (dbr:subdb-dbstack subdb))) (dbr:subdb-dbstack-set! subdb (make-stack))) - + (stack-push! (dbr:subdb-dbstack subdb) dbh))) )