283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
(sqlite3:finalize! (db:get-db dbstruct #f))
(let* ((local (dbr:dbstruct-get-local dbstruct))
(rundb (dbr:dbstruct-get-rundb dbstruct)))
(if local
(for-each
(lambda (db)
(if (sqlite3:database? db)
(sqlite3:finalize! db)))
(hash-table-values (dbr:dbstruct-get-locdbs dbstruct))))
(if rundb
(if (sqlite3:database? rundb)
(sqlite3:finalize! rundb)
(debug:print 2 "WARNING: attempting to close databases but got " rundb " instead of a database")))))
(define (db:open-inmem-db)
(let* ((db (sqlite3:open-database ":memory:"))
(handler (make-busy-timeout 3600)))
(db:initialize-run-id-db db)
(sqlite3:set-busy-handler! db handler)
db))
|
>
>
|
>
|
|
>
>
>
>
|
<
|
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
(sqlite3:finalize! (db:get-db dbstruct #f))
(let* ((local (dbr:dbstruct-get-local dbstruct))
(rundb (dbr:dbstruct-get-rundb dbstruct)))
(if local
(for-each
(lambda (db)
(if (sqlite3:database? db)
(begin
(sqlite3:interrupt! db)
(sqlite3:finalize! db #t))))
(hash-table-values (dbr:dbstruct-get-locdbs dbstruct))))
(thread-sleep! 3)
(if (and rundb
(sqlite3:database? rundb))
(handle-exceptions
exn
(debug:print 0 "WARNING: database files may not have been closed correctly. Consider running -cleanup-db")
(sqlite3:interrupt! rundb)
(sqlite3:finalize! rundb #t)))))
(define (db:open-inmem-db)
(let* ((db (sqlite3:open-database ":memory:"))
(handler (make-busy-timeout 3600)))
(db:initialize-run-id-db db)
(sqlite3:set-busy-handler! db handler)
db))
|