Megatest

Diff
Login

Differences From Artifact [aa16ae5aef]:

To Artifact [8624764a9d]:


259
260
261
262
263
264
265
266
267
268
269
270






271
272
273
274
275
276
277
259
260
261
262
263
264
265





266
267
268
269
270
271
272
273
274
275
276
277
278







-
-
-
-
-
+
+
+
+
+
+







;;
;;   NOTE: returns a dbdat not a dbstruct!
;;
(define (dbfile:open-sqlite3-db dbpath init-proc)
  (let* ((dbexists     (file-exists? dbpath))
	 (db           ;; need locking here so multiple open
	               ;; do not collide
	               (let* ((db (sqlite3:open-database dbpath)))
			 (init-proc db))
	               #;(dbfile:lock-create-open dbpath
					    (lambda (db)
                                              (init-proc db))))
	  (let* ((db (sqlite3:open-database dbpath)))
	    (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 10000))
	    (init-proc db))
	  #;(dbfile:lock-create-open dbpath
	  (lambda (db)
	  (init-proc db))))
	 (write-access (file-write-access? dbpath)))
    (dbfile:print-err  "db:open-sqlite-db "dbpath)
    #;(if (and dbexists (not write-access))
	(set! *db-write-access* #f))
    ;; (cons db dbpath)))
    (make-dbr:dbdat dbfile: dbpath dbh: db read-only: (not write-access))))