db-docs: fix the documentation for query-each and query-map

factor-shell
Alexander Iljin 2017-11-02 22:05:32 +01:00 committed by John Benediktsson
parent b6f2f85643
commit c9f5757dcd
2 changed files with 6 additions and 6 deletions

View File

@ -128,14 +128,14 @@ HELP: in-transaction?
HELP: query-each HELP: query-each
{ $values { $values
{ "statement" statement } { "quot" quotation } } { "result-set" result-set } { "quot" quotation } }
{ $description "A combinator that calls a quotation on 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: query-map HELP: query-map
{ $values { $values
{ "statement" statement } { "quot" quotation } { "result-set" result-set } { "quot" quotation }
{ "seq" sequence } } { "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 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." } ; { $description "Rolls back a transaction; no data is committed to the database. User code should make use of the " { $link with-transaction } " combinator." } ;

View File

@ -105,14 +105,14 @@ M: object execute-statement* ( statement type -- )
: sql-row-typed ( result-set -- seq ) : sql-row-typed ( result-set -- seq )
dup #columns [ row-column-typed ] with { } map-integers ; dup #columns [ row-column-typed ] with { } map-integers ;
: query-each ( statement quot: ( statement -- ) -- ) : query-each ( result-set quot: ( row -- ) -- )
over more-rows? [ over more-rows? [
[ call ] 2keep over advance-row query-each [ call ] 2keep over advance-row query-each
] [ ] [
2drop 2drop
] if ; inline recursive ] if ; inline recursive
: query-map ( statement quot -- seq ) : query-map ( result-set quot: ( row -- row' ) -- seq )
collector [ query-each ] dip { } like ; inline collector [ query-each ] dip { } like ; inline
: with-db ( db quot -- ) : with-db ( db quot -- )