summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/top.ur8
-rw-r--r--lib/top.urs6
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/top.ur b/lib/top.ur
index af009242..7c18da21 100644
--- a/lib/top.ur
+++ b/lib/top.ur
@@ -26,3 +26,11 @@ fun foldTRX2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (ctx :: {Unit})
[[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>
diff --git a/lib/top.urs b/lib/top.urs
index 0e211373..b124caa2 100644
--- a/lib/top.urs
+++ b/lib/top.urs
@@ -19,3 +19,9 @@ val foldTRX2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type) -> ctx :: {Unit}
-> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
-> tf1 t -> tf2 t -> xml ctx [] [])
-> r :: {Type} -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> xml ctx [] []
+
+val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
+ -> sql_query tables exps -> tables ~ exps
+ -> ($(exps ++ fold (fn nm (fields :: {Type}) acc => [nm] ~ acc => [nm = $fields] ++ acc) [] tables)
+ -> xml ctx [] [])
+ -> transaction (xml ctx [] [])