@@ -51,10 +51,16 @@ ;; (begin ;; (debug:print 4 "INFO: Turning off pragma synchronous") ;; (sqlite3:execute db "PRAGMA synchronous = 0;")) ;; (debug:print 4 "INFO: NOT turning off pragma synchronous")) db)) + +(define (open-run-close proc idb . params) + (let* ((db (if idb idb (open-db))) + (res (apply proc db params))) + (if (not idb)(sqlite3:finalize! db)) + res)) (define (db:initialize db) (let* ((configdat (car *configinfo*)) ;; tut tut, global warning... (keys (config-get-fields configdat)) (havekeys (> (length keys) 0)) @@ -1026,11 +1032,11 @@ (if tdb (let ((res '())) (sqlite3:for-each-row (lambda (id test_id category variable value expected tol units comment status type) (set! res (cons (vector id test_id category variable value expected tol units comment status type) res))) - db + tdb "SELECT id,test_id,category,variable,value,expected,tol,units,comment,status,type FROM test_data WHERE test_id=? AND category LIKE ? ORDER BY category,variable;" test-id categorypatt) (sqlite3:finalize! tdb) (reverse res)) '())))