diff lib/top.ur @ 334:9601c717d2f3

queryX
author Adam Chlipala <adamc@hcoop.net>
date Sat, 13 Sep 2008 19:49:53 -0400
parents 02d15d81ae9b
children 34847732cefc
line wrap: on
line diff
--- a/lib/top.ur	Sat Sep 13 14:58:57 2008 -0400
+++ b/lib/top.ur	Sat Sep 13 19:49:53 2008 -0400
@@ -26,3 +26,11 @@
                         [[nm] ~ rest] =>
                         fn r1 r2 acc => <xml>{f [nm] [t] [rest] r1 r2}{acc}</xml>)
                 <xml></xml>
+
+fun queryX (tables ::: {{Type}}) (exps ::: {Type}) (ctx ::: {Unit}) (q : sql_query tables exps) =
+        [tables ~ exps] =>
+        fn (f : $(exps ++ fold (fn nm (fields :: {Type}) acc => [nm] ~ acc => [nm = $fields] ++ acc) [] tables)
+                -> xml ctx [] []) =>
+        query q
+                (fn fs acc => return <xml>{acc}{f fs}</xml>)
+                <xml></xml>