HELP: query-each
{ $values
- { "statement" statement } { "quot" quotation } }
-{ $description "A combinator that calls a quotation on a sequence of SQL statements to their results query results." } ;
+ { "result-set" result-set } { "quot" quotation } }
+{ $description "Applies the quotation to each row of the " { $link result-set } " in order." } ;
HELP: query-map
{ $values
- { "statement" statement } { "quot" quotation }
+ { "result-set" result-set } { "quot" quotation }
{ "seq" sequence } }
-{ $description "A combinator that maps a sequence of SQL statements to their results query results." } ;
+{ $description "Applies the quotation to each row of the " { $link result-set } " in order." } ;
HELP: rollback-transaction
{ $description "Rolls back a transaction; no data is committed to the database. User code should make use of the " { $link with-transaction } " combinator." } ;
: sql-row-typed ( result-set -- seq )
dup #columns [ row-column-typed ] with { } map-integers ;
-: query-each ( statement quot: ( statement -- ) -- )
+: query-each ( result-set quot: ( row -- ) -- )
over more-rows? [
[ call ] 2keep over advance-row query-each
] [
2drop
] if ; inline recursive
-: query-map ( statement quot -- seq )
+: query-map ( result-set quot: ( row -- row' ) -- seq )
collector [ query-each ] dip { } like ; inline
: with-db ( db quot -- )