13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
+
+
+
+
+
-
+
|
;; query-params ;; list of params for the query
;; conn ;; connection to db
;; num-rows ;; whatever
;; curr-row-ptr ;; number of the current row
;; curr-row ;; the current row vector (?? do we really want this ??)
;; ))
(module sqltbl
*
(import chicken scheme data-structures extras srfi-13 ports )
(declare (unit sqltbl))
;; (declare (unit sqltbl))
(define (make-sqltbl:tbl)(make-vector 9))
(define (sqltbl:tbl-get-rows vec) (vector-ref vec 0))
(define (sqltbl:tbl-get-fields vec) (vector-ref vec 1))
(define (sqltbl:tbl-get-fields-hash vec) (vector-ref vec 2))
(define (sqltbl:tbl-get-query vec) (vector-ref vec 3))
(define (sqltbl:tbl-get-query-params vec) (vector-ref vec 4))
|
107
108
109
110
111
112
113
|
112
113
114
115
116
117
118
119
|
+
|
;; runs proc on each row and returns the resulting list
(define (sqltbl:map self proc)
(map (lambda (row)
(proc (sqltbl:vector->hash self row))) (sqltbl:tbl-get-rows self)))
)
|