Megatest

Check-in [3aef5315e7]
Login
Overview
Comment:Fixed db:get-test-data-by-id to fail gracefully
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.44 | v1.4402
Files: files | file ages | folders
SHA1: 3aef5315e7fa6457c7c69ecb1315a8b06e2b0263
User & Date: mrwellan on 2012-06-27 15:21:07
Other Links: branch diff | manifest | tags
Context
2012-07-15
23:46
Added synchronous=0 as an option check-in: 5d13f2e3fb user: matt tags: v1.44
2012-06-27
15:21
Fixed db:get-test-data-by-id to fail gracefully check-in: 3aef5315e7 user: mrwellan tags: v1.44, v1.4402
13:51
Fixed typo check-in: d3fc157db1 user: mrwellan tags: v1.44
Changes

Modified db.scm from [9c55b17e1a] to [c881958987].

577
578
579
580
581
582
583




584
585
586
587
588
589
590
591








592
593
594
595
596
597
598
577
578
579
580
581
582
583
584
585
586
587








588
589
590
591
592
593
594
595
596
597
598
599
600
601
602







+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+







     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)
  (if (not test-id)
      (begin
	(debug:print 0 "INFO: db:get-test-data-by-id called with test-id=" test-id)
	#f)
  (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))
      (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 test-id comment)
  (sqlite3:execute 
   db 
   "UPDATE tests SET comment=? WHERE id=?;"
   comment test-id))