33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
(lambda (key)
(let ((qry (conc "SELECT " (key:get-fieldname key) " FROM runs WHERE id=?;")))
;; (print "qry: " qry)
(sqlite3:for-each-row
(lambda (key-val)
(set! res (cons key-val res)))
db qry run-id)))
keys)
(reverse res)))
(define (keys->keystr keys) ;; => key1,key2,key3,additiona1, ...
(string-intersperse (map key:get-fieldname keys) ","))
(define-inline (keys->valslots keys) ;; => ?,?,? ....
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
(lambda (key)
(let ((qry (conc "SELECT " (key:get-fieldname key) " FROM runs WHERE id=?;")))
;; (print "qry: " qry)
(sqlite3:for-each-row
(lambda (key-val)
(set! res (cons key-val res)))
db qry run-id)))
keys)
(reverse res)))
;; get key val pairs for a given run-id
;; ( (FIELDNAME1 keyval1) (FIELDNAME2 keyval2) ... )
(define (keys:get-key-val-pairs db run-id)
(let* ((keys (get-keys db))
(res '()))
;; (print "keys: " keys " run-id: " run-id)
(for-each
(lambda (key)
(let ((qry (conc "SELECT " (key:get-fieldname key) " FROM runs WHERE id=?;")))
;; (print "qry: " qry)
(sqlite3:for-each-row
(lambda (key-val)
(set! res (cons (list (key:get-fieldname key) key-val) res)))
db qry run-id)))
keys)
(reverse res)))
(define (keys->keystr keys) ;; => key1,key2,key3,additiona1, ...
(string-intersperse (map key:get-fieldname keys) ","))
(define-inline (keys->valslots keys) ;; => ?,?,? ....
|