summaryrefslogtreecommitdiff
path: root/lib/top.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-06 17:09:53 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-06 17:09:53 -0500
commit36952b2e49afdb4ba8024eb6372992e4b5d8df7a (patch)
tree16401277a8c24a1bcfcc410700526f64ba27a5b8 /lib/top.ur
parent49f721d39e46ab0635cc2e9a5ed2a66944586640 (diff)
About to begin optimization of recursive transaction functions
Diffstat (limited to 'lib/top.ur')
-rw-r--r--lib/top.ur11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/top.ur b/lib/top.ur
index 347b2a35..abc70e53 100644
--- a/lib/top.ur
+++ b/lib/top.ur
@@ -202,6 +202,17 @@ fun queryX (tables ::: {{Type}}) (exps ::: {Type}) (ctx ::: {Unit})
(fn fs acc => return <xml>{acc}{f fs}</xml>)
<xml/>
+fun queryX' (tables ::: {{Type}}) (exps ::: {Type}) (ctx ::: {Unit})
+ (q : sql_query tables exps) [tables ~ exps]
+ (f : $(exps ++ fold (fn nm (fields :: {Type}) acc [[nm] ~ acc] =>
+ [nm = $fields] ++ acc) [] tables)
+ -> transaction (xml ctx [] [])) =
+ query q
+ (fn fs acc =>
+ r <- f fs;
+ return <xml>{acc}{r}</xml>)
+ <xml/>
+
fun oneOrNoRows (tables ::: {{Type}}) (exps ::: {Type})
(q : sql_query tables exps) [tables ~ exps] =
query q