Random Bits of Open Code

Check-in [ac0641f1dd]
Login

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

Overview
Comment:added limit and offset the qry in get-runs-info
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ac0641f1ddf895e5b29eb7a2c1bccad558e0b202
User & Date: pjhatwal 2018-07-12 20:06:16
Context
2018-07-12
20:30
Cleaned up a bit check-in: 8808f212d2 user: mrwellan tags: trunk
20:06
added limit and offset the qry in get-runs-info check-in: ac0641f1dd user: pjhatwal tags: trunk
2018-07-10
06:53
Adding missing STDFLAGS back so that -fPIC can be used for iup, cd and im. check-in: 6fc31b890f user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mtutils/mtdb/mtdb.scm.

594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
   "SELECT runname FROM runs WHERE id=?;"
   run-id))

;; given patterns for target, run-name and area, return all runs info
;;
;;  (use mtdb)(define adat (make-adat name: "foo" path: "/mfs/home/matt/data/megatest/ext-tests"))(adat-init adat "/mfs/home/matt/data/megatest/ext-tests")(with-common-db adat (lambda (dbh)(length (get-runs-info dbh "%" "%" "%"))))
;;
(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 state != 'deleted' AND 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







|
|





|
|







594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
   "SELECT runname FROM runs WHERE id=?;"
   run-id))

;; given patterns for target, run-name and area, return all runs info
;;
;;  (use mtdb)(define adat (make-adat name: "foo" path: "/mfs/home/matt/data/megatest/ext-tests"))(adat-init adat "/mfs/home/matt/data/megatest/ext-tests")(with-common-db adat (lambda (dbh)(length (get-runs-info dbh "%" "%" "%"))))
;;
(define (get-runs-info dbh target-patt run-name-patt area-patt offset limit) ;; to join ttype or not?
  (reverse (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 state != 'deleted' AND 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 LIMIT ?  OFFSET ? ;"
   target-patt run-name-patt area-patt limit offset))) ;;Note: reverse the list 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