65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
(hash-table-ref/default (dbr:dbstruct-locdbs v) run-id #f))
(define (dbr:dbstruct-localdb-set! v run-id db)
(hash-table-set! (dbr:dbstruct-locdbs v) run-id db))
(require-extension typed-records)
(defstruct db:test-rec ((id -1) : number)
((run_id -1) : number)
((testname "") : string)
((state "") : string)
((status "") : string)
((event_time -1) : number)
((host "") : string)
((cpuload -1) : number)
((diskfree -1) : number)
((uname "") : string)
((rundir "") : string)
((item_path "") : string)
((run_duration -1) : number)
((final_logf "") : string)
((comment "") : string)
((process-id -1) : number)
((archived -1) : number)
((shortdir -1) : number)
((attemptnum -1) : number))
"id" "run_id" "testname" "state" "status" "event_time"
"host" "cpuload" "diskfree" "uname" "rundir" "item_path"
"run_duration" "final_logf" "comment" "shortdir" "attemptnum" "archived"
(define (db:qry-gen-alist qrystr listvals)
(define listqry (string-split qrystr ","))
(if (null? listqry)
'()
(let loop ((strhead (car listqry))
(strtail (cdr listqry))
(valhead (car listvals))
(valtail (cdr listvals))
(res '()))
(let* ((slot-val-pair (cons (string->symbol strhead) valhead)))
(if (or (null? strtail)
(null? valtail))
(cons slot-val-pair res);;(print strhead valhead));;(cons (cons (string->symbol strhead) valhead) res))
(loop (car strtail)(cdr strtail)(car valtail)(cdr valtail)(cons slot-val-pair res)))))))
(define (db:test-get-id typed-rec) (db:test-rec-id typed-rec))
(define (db:test-get-run_id typed-rec) (db:test-rec-run_id typed-rec))
(define (db:test-get-testname typed-rec) (db:test-rec-testname typed-rec))
(define (db:test-get-state typed-rec) (db:test-rec-state typed-rec))
(define (db:test-get-status typed-rec) (db:test-rec-status typed-rec))
(define (db:test-get-event_time typed-rec) (db:test-rec-event_time typed-rec))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
(hash-table-ref/default (dbr:dbstruct-locdbs v) run-id #f))
(define (dbr:dbstruct-localdb-set! v run-id db)
(hash-table-set! (dbr:dbstruct-locdbs v) run-id db))
(require-extension typed-records)
(defstruct db:test-rec ((id -1) : number)
((run_id -1) : number)
((testname "") : string)
((state "") : string)
((status "") : string)
((event_time -1) : number)
((host "") : string)
((cpuload -1) : number)
((diskfree -1) : number)
((uname "") : string)
((rundir "") : string)
((item_path "") : string)
((run_duration -1) : number)
((final_logf "") : string)
((comment "") : string)
((process-id -1) : number)
((archived -1) : number)
((shortdir -1) : number)
((attemptnum -1) : number))
(define (db:qry-gen-alist qrystr listvals)
(define listqry (string-split qrystr ","))
(if (null? listqry)
'()
(let loop ((strhead (car listqry))
(strtail (cdr listqry))
(valhead (car listvals))
(valtail (cdr listvals))
(res '()))
(let* ((slot-val-pair (cons (string->symbol strhead) valhead)))
(if (or (null? strtail)
(null? valtail))
(cons slot-val-pair res);;(print strhead valhead));;(cons (cons (string->symbol strhead) valhead) res))
(loop (car strtail)(cdr strtail)(car valtail)(cdr valtail)(cons slot-val-pair res)))))))
(define (db:test-get-id typed-rec) (db:test-rec-id typed-rec))
(define (db:test-get-run_id typed-rec) (db:test-rec-run_id typed-rec))
(define (db:test-get-testname typed-rec) (db:test-rec-testname typed-rec))
(define (db:test-get-state typed-rec) (db:test-rec-state typed-rec))
(define (db:test-get-status typed-rec) (db:test-rec-status typed-rec))
(define (db:test-get-event_time typed-rec) (db:test-rec-event_time typed-rec))
|