172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
-
+
-
+
|
(let* ((parent-dir (pathname-directory fname))
(dir-writable (file-write-access? parent-dir))
(file-exists (file-exists? fname))
(file-write (if file-exists
(file-write-access? fname)
dir-writable )))
(if file-write ;; dir-writable
(let ((lock (obtain-dot-lock fname 1 5 10))
(let (;; (lock (obtain-dot-lock fname 1 5 10))
(db (sqlite3:open-database fname)))
(sqlite3:set-busy-handler! db (make-busy-timeout 136000))
(db:set-sync db) ;; (sqlite3:execute db "PRAGMA synchronous = 0;")
(if (not file-exists)(initproc db))
(release-dot-lock fname)
;; (release-dot-lock fname)
db)
(begin
(debug:print 0 "ERROR: no such db in non-writable dir " fname)
(sqlite3:open-database fname))))) ;; )
;; This routine creates the db. It is only called if the db is not already opened
;;
|