chickadee » sql-de-lite » for-each-row

for-each-row procprocedure
for-each-row* procprocedure

Returns a procedure suitable for passing to query, taking one argument, a statement object.

The procedure will call fetch once for each row and call your callback as (proc row), discarding the results.

(query (for-each-row
         (lambda (x) (print "row: " x)))
       s)
; row: (1 foo bar)
; row: (2 baz quux)
; => undefined

for-each-row* behaves like for-each-row, but your callback is invoked with one argument for each column value. For example, these produce equivalent results:

(query (for-each-row (match-lambda ((name sql)
                        (print "table: " name " sql: " sql ";"))))
       (sql db "select name, sql from sqlite_master;"))
(query (for-each-row* (lambda (name sql)
                        (print "table: " name " sql: " sql ";")))
       (sql db "select name, sql from sqlite_master;"))