101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
-
-
+
+
|
(write-access (file-write-access? dbpath))
(dbdat '())
(mdb (cond ;; what the hek is *toppath* doing here?
((and (string? *toppath*)(file-write-access? *toppath*))
(set! dbdat (cons (cons 'dbname dbfile) dbdat))
(dbi:open 'sqlite3 dbdat))
((file-read-access? dbpath) (dbi:open 'sqlite3 dbdat))
(else (dbi:open 'sqlite3 '((dbname . ":memory:")))))) ;; (never-give-up-open-db dbpath))
(handler (make-busy-timeout 36000)))
(else (dbi:open 'sqlite3 '((dbname . ":memory:"))))))) ;; (never-give-up-open-db dbpath))
;;(handler (make-busy-timeout 36000)))
(if (and exists
(not write-access))
(set! *db-write-access* write-access)) ;; only unset so other db's also can use this control
;;(sqlite3:set-busy-handler! mdb handler)
(db:set-sync mdb) ;; (dbi:exec mdb (conc "PRAGMA synchronous = 0;"))
;; (if (or (and (not exists)
|