]> gitweb.factorcode.org Git - factor.git/commitdiff
db.queries: set the "table-name" inside a with-variables.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 14 Feb 2018 18:39:20 +0000 (10:39 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 14 Feb 2018 18:39:20 +0000 (10:39 -0800)
basis/db/queries/queries.factor

index 00799950bf0fed274e56a6f81d009186a7ac05f1..3357ee5635e1c0a42ab3b04408d69f78b6581efe 100644 (file)
@@ -46,11 +46,10 @@ M: retryable execute-statement* ( statement type -- )
 : sql-props ( class -- columns table )
     [ db-columns ] [ db-table-name ] bi ;
 
-: query-make ( class quot -- statements )
+: query-make ( ..a class quot: ( ..a columns table -- ..b ) -- ..b statements )
     ! query, input, outputs, secondary queries
-    over db-table-name "table-name" set
     [ sql-props ] dip
-    [ 0 sql-counter rot with-variable ] curry
+    '[ 0 sql-counter [ dup "table-name" set @ ] with-variable ]
     { "" { } { } { } } nmake
     [ <simple-statement> maybe-make-retryable ] dip
     [ [ 1array ] dip append ] unless-empty ; inline