443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
|
;;======================================================================
;; if we are not a server create a db handle. this is not finalized
;; so watch for problems. I'm still not clear if it is needed to manually
;; finalize sqlite3 dbs with the sqlite3 egg.
;;
(define (db:no-sync-db db-in)
(mutex-lock! *db-access-mutex*)
(let ((res (if db-in
db-in
(let ((db (dbfile:open-no-sync-db)))
(set! *no-sync-db* db)
db))))
(mutex-unlock! *db-access-mutex*)
res))
(define (dbfile:open-no-sync-db dbpath)
(let* (;; (dbpath (db:dbfile-path))
(dbname (conc dbpath "/no-sync.db"))
(db-exists (file-exists? dbname))
(db (sqlite3:open-database dbname)))
(sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000))
|
<
|
|
>
>
>
>
|
|
<
|
|
|
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
;;======================================================================
;; if we are not a server create a db handle. this is not finalized
;; so watch for problems. I'm still not clear if it is needed to manually
;; finalize sqlite3 dbs with the sqlite3 egg.
;;
(define (db:no-sync-db db-in)
(if db-in
db-in
(if *no-sync-db*
*no-sync-db*
(begin
(mutex-lock! *db-access-mutex*)
(let ((db (dbfile:open-no-sync-db)))
(set! *no-sync-db* db)
(mutex-unlock! *db-access-mutex*)
db)))))
(define (dbfile:open-no-sync-db dbpath)
(let* (;; (dbpath (db:dbfile-path))
(dbname (conc dbpath "/no-sync.db"))
(db-exists (file-exists? dbname))
(db (sqlite3:open-database dbname)))
(sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000))
|