]> gitweb.factorcode.org Git - factor.git/commitdiff
db-docs: fix the documentation for query-each and query-map
authorAlexander Iljin <ajsoft@yandex.ru>
Thu, 2 Nov 2017 21:05:32 +0000 (22:05 +0100)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 16 Jan 2018 21:40:14 +0000 (13:40 -0800)
basis/db/db-docs.factor
basis/db/db.factor

index c668e9b9330a26505b476cfe4a232262658309d2..7e711aa90c1f17b8ec9d48d29a9e95be2b2e68d0 100644 (file)
@@ -128,14 +128,14 @@ HELP: in-transaction?
 
 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." } ;
index de041aee2a8acb5e211c93cb2c5901a130802b44..e6b0549612aaced57aae0983e3fa91b61ac71f4b 100644 (file)
@@ -105,14 +105,14 @@ M: object execute-statement* ( statement type -- )
 : 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 -- )