Megatest

Diff
Login

Differences From Artifact [b22d01852d]:

To Artifact [11e94b6a23]:


210
211
212
213
214
215
216











217
218
219
220
221
222
223
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234







+
+
+
+
+
+
+
+
+
+
+







(define (db:delete-test-step-records db run-id test-name itemdat)
  (sqlite3:execute db "DELETE FROM test_steps WHERE test_id in (SELECT id FROM tests WHERE run_id=? AND testname=? AND item_path=?);" 
		   run-id test-name (item-list->path itemdat)))
;; 
(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))

;; set tests with state currstate and status currstatus to newstate and newstatus
;; use currstate = #f and or currstatus = #f to apply to any state or status respectively
;; WARNING: SQL injection risk
(define (db:set-tests-state-status db run-id tests currstate currstatus newstate newstatus)
  (sqlite3:execute db (conc "UPDATE tests SET state=?,status=? WHERE "
			    (if currstate  (conc "state='" currstate "' AND ") "")
			    (if currstatus (conc "status='" currstatus "' AND ") "")
			    " testname in "
			    "('" (string-intersperse tests "','") "')")
		   newstate newstatus))

(define (db:get-count-tests-running db)
  (let ((res 0))
    (sqlite3:for-each-row
     (lambda (count)
       (set! res count))
     db