169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
(sqlite3:execute
db
"INSERT OR IGNORE INTO tests (id,run_id,testname,event_time,item_path,state,status) VALUES (?,?,'bogustest',strftime('%s','now'),'nowherepath','DELETED','n/a');"
(* run-id 30000) ;; allow for up to 30k tests per run
run-id)
))) ;; add strings db to rundb, not in use yet
;; )) ;; (sqlite3:open-database dbpath))
(olddb (db:open-megatest-db))
(write-access (file-write-access? dbpath))
;; (handler (make-busy-timeout 136000))
)
(if (and dbexists (not write-access))
(set! *db-write-access* #f)) ;; only unset so other db's also can use this control
(dbr:dbstruct-set-rundb! dbstruct db)
(dbr:dbstruct-set-inuse! dbstruct #t)
|
>
>
|
>
>
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
(sqlite3:execute
db
"INSERT OR IGNORE INTO tests (id,run_id,testname,event_time,item_path,state,status) VALUES (?,?,'bogustest',strftime('%s','now'),'nowherepath','DELETED','n/a');"
(* run-id 30000) ;; allow for up to 30k tests per run
run-id)
))) ;; add strings db to rundb, not in use yet
;; )) ;; (sqlite3:open-database dbpath))
(olddb (if *megatest-db*
*megatest-db*
(let ((db (db:open-megatest-db)))
(set! *megatest-db* db)
db)))
(write-access (file-write-access? dbpath))
;; (handler (make-busy-timeout 136000))
)
(if (and dbexists (not write-access))
(set! *db-write-access* #f)) ;; only unset so other db's also can use this control
(dbr:dbstruct-set-rundb! dbstruct db)
(dbr:dbstruct-set-inuse! dbstruct #t)
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
(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 (sqlite3:database? rundb)
(sqlite3:finalize! rundb)
(debug:print 0 "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))
|
|
>
|
|
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
(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))
|