@@ -110,10 +110,18 @@ ;;====================================================================== ;; R U N S ;;====================================================================== +(define (runs:get-std-run-fields keys remfields) + (let* ((header (append (map key:get-fieldname keys) + remfields)) + (keystr (conc (keys->keystr keys) "," + (string-intersperse remfields ",")))) + (list keystr header))) + +;; replace header and keystr with a call to runs:get-std-run-fields (define (db-get-runs db runpatt . count) (let* ((res '()) (keys (db-get-keys db)) (remfields (list "id" "runname" "state" "status" "owner" "event_time")) (header (append (map key:get-fieldname keys) @@ -157,10 +165,13 @@ (vector header res))) (define (db:set-comment-for-run db run-id comment) (sqlite3:execute db "UPDATE runs SET comment=? WHERE id=?;" comment run-id)) +(define (db:delete-run db run-id) + (sqlite3:execute db "DELETE FROM runs WHERE id=?;" run-id)) + ;;====================================================================== ;; T E S T S ;;====================================================================== (define (make-db:test)(make-vector 6)) @@ -190,13 +201,19 @@ db "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment FROM tests WHERE run_id=? AND testname like ? AND item_path LIKE ? ORDER BY id DESC;" run-id testpatt (if itempatt itempatt "%")) res)) +;; this one is a bit broken BUG FIXME (define (db:delete-test-step-records db run-id test-name) (sqlite3:execute db "DELETE FROM test_steps WHERE test_id in (SELECT id FROM tests WHERE run_id=? AND testname=?);" run-id test-name)) +;; +(define (db:delete-test-records db test-id) + (sqlite3:execute db "DELETE FROM test_steps WHERE test_id=?;" test-id) + (sqlite3:execute db "DELETE FROM tests WHERE id=?;" test-id)) + (define (db:get-count-tests-running db) (let ((res 0)) (sqlite3:for-each-row (lambda (count) (set! res count))