Overview
Comment: | Made dbfile:get-dbdat check the subdb. Added a couple of tests |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.7001-multi-db-rb01 |
Files: | files | file ages | folders |
SHA1: |
bc14ff3da99951b4fedf8c99ddad702d |
User & Date: | mmgraham on 2022-03-31 20:32:37 |
Other Links: | branch diff | manifest | tags |
Context
2022-04-05
| ||
17:18 | Cleanup check-in: e5eaa400fa user: matt tags: v1.7001-multi-db-rb01 | |
17:13 | Fixed dbfile:get-dbdat, removed calls to add-dbdat in init-subdb, enhanced the tests. check-in: 9b31e3ddb8 user: mmgraham tags: v1.7001-multi-db-rb01 | |
2022-03-31
| ||
20:32 | Made dbfile:get-dbdat check the subdb. Added a couple of tests check-in: bc14ff3da9 user: mmgraham tags: v1.7001-multi-db-rb01 | |
2022-03-28
| ||
20:39 | Attached stmt cache to db via dbdat. Use dbdat in db:with-db. check-in: 12aae89d94 user: matt tags: v1.7001-multi-db-rb01 | |
Changes
Modified dbfile.scm from [be245468de] to [aa16ae5aef].
︙ | ︙ | |||
202 203 204 205 206 207 208 | ;; 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 (dbfile:get-dbdat dbstruct run-id) (let* ((subdb (dbfile:get-subdb dbstruct run-id))) | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | ;; 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 (dbfile:get-dbdat dbstruct run-id) (let* ((subdb (dbfile:get-subdb dbstruct run-id))) (if (or (not subdb) stack-empty? (dbr:subdb-dbstack subdb)) #f (stack-pop! (dbr:subdb-dbstack subdb))))) ;; return a previously opened db handle to the stack of available handles (define (dbfile:add-dbdat dbstruct run-id dbdat) (let* ((subdb (dbfile:get-subdb dbstruct run-id))) (stack-push! (dbr:subdb-dbstack subdb) dbdat))) |
︙ | ︙ |
Modified tests/simplerun/thebeginning.scm from [5b513666c4] to [4bb9f4885a].
︙ | ︙ | |||
17 18 19 20 21 22 23 | (test #f #t (dbr:dbstruct? (db:setup #t))) (define dbstruct *dbstruct-dbs*) (test #f #f (dbfile:get-subdb dbstruct #f)) ;; get main.db (never opened yet) (test #f #f (dbfile:get-subdb dbstruct 1)) ;; get 1.db (test #f #t (hash-table? (dbr:dbstruct-subdbs dbstruct))) (test #f #t (dbr:dbdat? (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db))) (test #f '("SYSTEM" "RELEASE") (db:get-keys *dbstruct-dbs*)) | | | | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | (test #f #t (dbr:dbstruct? (db:setup #t))) (define dbstruct *dbstruct-dbs*) (test #f #f (dbfile:get-subdb dbstruct #f)) ;; get main.db (never opened yet) (test #f #f (dbfile:get-subdb dbstruct 1)) ;; get 1.db (test #f #t (hash-table? (dbr:dbstruct-subdbs dbstruct))) (test #f #t (dbr:dbdat? (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db))) (test #f '("SYSTEM" "RELEASE") (db:get-keys *dbstruct-dbs*)) (test #f #f (dbr:dbdat? (dbfile:get-dbdat dbstruct 1))) ;; not open yet (test #f #f (sqlite3:database? (db:open-db dbstruct #f))) (test #f #f (sqlite3:database? (db:open-db dbstruct 1))) ;; (test #f #t (stack? (dbr:subdb-dbstack subdb ;; test #f #f (db:get-subdb dbstruct 1)) ;; ;; ; (test #f #f (stack? (dbr:subdb-dbstack subdb))) |