@@ -149,11 +149,11 @@ ;; use this one for db-get-run-info (define-inline (db:get-row vec)(vector-ref vec 1)) ;; use (get-value-by-header (db:get-header runinfo)(db:get-row runinfo)) -(define (db-get-run-info db run-id) +(define (db:get-run-info db run-id) (let* ((res #f) (keys (db-get-keys db)) (remfields (list "id" "runname" "state" "status" "owner" "event_time")) (header (append (map key:get-fieldname keys) remfields)) @@ -258,11 +258,22 @@ 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=? AND item_path=?;" run-id testname item-path) res)) -;; +;; Get test data using test_id +(define (db:get-test-data-by-id db test-id) + (let ((res #f)) + (sqlite3:for-each-row + (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment) + (set! res (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment))) + 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 id=?;" + test-id) + res)) + + (define (db:test-set-comment db run-id testname item-path comment) (sqlite3:execute db "UPDATE tests SET comment=? WHERE run_id=? AND testname=? AND item_path=?;" comment run-id testname item-path)) @@ -291,11 +302,12 @@ (define-inline (db:step-set-stepname! vec val)(vector-set! vec 2 val)) (define-inline (db:step-set-state! vec val)(vector-set! vec 3 val)) (define-inline (db:step-set-status! vec val)(vector-set! vec 4 val)) (define-inline (db:step-set-event_time! vec val)(vector-set! vec 5 val)) -(define (db-get-test-steps-for-run db test-id) +;; db-get-test-steps-for-run +(define (db:get-steps-for-test db test-id) (let ((res '())) (sqlite3:for-each-row (lambda (id test-id stepname state status event-time) (set! res (cons (vector id test-id stepname state status event-time) res))) db