9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
;; dbfile:add-dbdat
;; db:initialize-main-db
;; dbfile:set-subdb
;; db:with-db
;; dbfile:get-subdb
)
(define tmpdir (common:get-db-tmp-area))
(test #f #t (dbr:dbstruct? (dbfile:setup #t *toppath* tmpdir)))
(test #f #t (dbr:dbstruct? (db:setup #t)))
(define dbstruct *dbstruct-dbs*)
(test #f #t (dbr:dbdat? (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db)))
(define maindbdat (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db))
(dbfile:add-dbdat dbstruct #f maindbdat)
|
>
>
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
;; dbfile:add-dbdat
;; db:initialize-main-db
;; dbfile:set-subdb
;; db:with-db
;; dbfile:get-subdb
)
;; *************** dbfile.scm tests ****************
(define tmpdir (common:get-db-tmp-area))
(test #f #t (dbr:dbstruct? (dbfile:setup #t *toppath* tmpdir)))
(test #f #t (dbr:dbstruct? (db:setup #t)))
(define dbstruct *dbstruct-dbs*)
(test #f #t (dbr:dbdat? (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db)))
(define maindbdat (dbfile:open-db *dbstruct-dbs* #f db:initialize-main-db))
(dbfile:add-dbdat dbstruct #f maindbdat)
|
36
37
38
39
40
41
42
|
(test #f #t (dbr:dbdat? (dbfile:get-dbdat dbstruct 1)))
(test #f #t (db:close-all dbstruct))
(test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh rundbdat) (dbr:dbdat-stmt-cache rundbdat)))
(test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh maindbdat) (dbr:dbdat-stmt-cache maindbdat)))
|
>
>
>
>
>
>
>
>
>
>
>
>
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
(test #f #t (dbr:dbdat? (dbfile:get-dbdat dbstruct 1)))
(test #f #t (db:close-all dbstruct))
(test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh rundbdat) (dbr:dbdat-stmt-cache rundbdat)))
(test #f #t (db:safely-close-sqlite3-db (dbr:dbdat-dbh maindbdat) (dbr:dbdat-stmt-cache maindbdat)))
(test #f #t (> (dbfile:lazy-sqlite-db-modification-time ".db/main.db") 0))
(test #f #t (common:simple-file-lock "./db.lock"))
(test #f "./db.lock" (common:simple-file-release-lock "./db.lock"))
;; *************** db.scm tests ****************
(define thisdbdat (db:open-db dbstruct #f))
(test #f #t (dbr:dbdat? thisdbdat))
|