Random Bits of Open Code

Check-in [cfcf6d3c8e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Switch order of data returned from get-area-infos.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:cfcf6d3c8ef44600870b6bbfcedd84ff5d92b8ac
User & Date: matt 2018-05-08 06:10:27
Context
2018-05-08
11:19
Fix case where . is provided as directory. check-in: 478335bf96 user: matt tags: trunk
06:10
Switch order of data returned from get-area-infos. check-in: cfcf6d3c8e user: matt tags: trunk
03:37
Make adat-init optionally set up the megatest source area. check-in: d7beec78b6 user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mtutils/mtdb/mtdb.scm.

41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
...
408
409
410
411
412
413
414
415
416
417
418
419



420
421
422
423
424
425
426
...
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
     
     ;; targets
     get-ttype

     ;; areas
     add-area
     get-areas
     set-area

     get-area-by-path
     write-sync-time
     get/add-area

     ;; area tags
     is-area-tagged
     add-area-tag
     get-tag-info-by-name
................................................................................
(define (get/add-area dbh area-name area-path)
  (or (get-area-by-path dbh area-path)
      (begin
	(add-area dbh area-name area-path)
	(get-area-by-path dbh area-path))))

(define (get-areas dbh)
  ;; (map
  ;;  (lambda (row)
  ;;    (print "row: " row))
  (dbi:get-rows dbh "SELECT id,area_name,area_path,last_sync FROM areas;")) ;; )




;; given an area_path get the area info
;;
(define (get-area-by-path dbh area-path)
  (dbi:get-one-row dbh "SELECT id,area_name,area_path,last_sync FROM areas WHERE area_path=?;" area-path))

(define (write-sync-time dbh area-info new-sync-time)
  (let ((area-id (vector-ref area-info 0)))
................................................................................
(define (get-runs-info dbh target-patt run-name-patt area-patt) ;; to join ttype or not?
  (dbi:fold-row
   cons
   '()
   dbh   ;; 0    1       2       3      4     5      6       7        8         9         10          11         12
   "SELECT id,target,ttype_id,run_name,state,status,owner,event_time,comment,fail_count,pass_count,last_update,area_id
       FROM runs WHERE target LIKE ? AND run_name LIKE ? AND area_id IN (SELECT id FROM areas WHERE area_name LIKE ?)
       ORDER BY event_time DESC, id DESC;"
   target-patt run-name-patt area-patt))

;;======================================================================
;;  T E S T - S T E P S
;;======================================================================

(define (get-test-step-id dbh test-id stepname state)
  (dbi:get-one







|
>
|







 







<
<
<


>
>
>







 







|
|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
409
410
411
412
413
414
415



416
417
418
419
420
421
422
423
424
425
426
427
...
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
     
     ;; targets
     get-ttype

     ;; areas
     add-area
     get-areas
     get-area-by-path
     get-areas-by-name
     set-area
     write-sync-time
     get/add-area

     ;; area tags
     is-area-tagged
     add-area-tag
     get-tag-info-by-name
................................................................................
(define (get/add-area dbh area-name area-path)
  (or (get-area-by-path dbh area-path)
      (begin
	(add-area dbh area-name area-path)
	(get-area-by-path dbh area-path))))

(define (get-areas dbh)



  (dbi:get-rows dbh "SELECT id,area_name,area_path,last_sync FROM areas;")) ;; )

(define (get-areas-by-name dbh name-patt)
  (dbi:get-rows dbh "SELECT id,area_name,area_path,last_sync FROM areas WHERE area_name LIKE ?;" name-patt))

;; given an area_path get the area info
;;
(define (get-area-by-path dbh area-path)
  (dbi:get-one-row dbh "SELECT id,area_name,area_path,last_sync FROM areas WHERE area_path=?;" area-path))

(define (write-sync-time dbh area-info new-sync-time)
  (let ((area-id (vector-ref area-info 0)))
................................................................................
(define (get-runs-info dbh target-patt run-name-patt area-patt) ;; to join ttype or not?
  (dbi:fold-row
   cons
   '()
   dbh   ;; 0    1       2       3      4     5      6       7        8         9         10          11         12
   "SELECT id,target,ttype_id,run_name,state,status,owner,event_time,comment,fail_count,pass_count,last_update,area_id
       FROM runs WHERE target LIKE ? AND run_name LIKE ? AND area_id IN (SELECT id FROM areas WHERE area_name LIKE ?)
       ORDER BY event_time ASC, id DESC;"
   target-patt run-name-patt area-patt)) ;; note: use ASC because we are cons'ing the data

;;======================================================================
;;  T E S T - S T E P S
;;======================================================================

(define (get-test-step-id dbh test-id stepname state)
  (dbi:get-one