diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-07-17 12:25:34 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-07-17 12:25:34 -0400 |
commit | ec734c14f2569e58e462097d5953a26f9fa84f69 (patch) | |
tree | 01175fcf8d29d98dc9ca279350fd43f4f6d242ee /tests | |
parent | c01c7e97334a180b55b11a1bba93cf046628948d (diff) |
Testing nested queries
Diffstat (limited to 'tests')
-rw-r--r-- | tests/nested.ur | 29 | ||||
-rw-r--r-- | tests/nested.urp | 5 | ||||
-rw-r--r-- | tests/nested.urs | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/nested.ur b/tests/nested.ur new file mode 100644 index 00000000..a23ae2ac --- /dev/null +++ b/tests/nested.ur @@ -0,0 +1,29 @@ +table t : {A : int, B : int} + +fun init () = + dml (DELETE FROM t WHERE TRUE); + dml (INSERT INTO t (A, B) VALUES (1, 2)); + dml (INSERT INTO t (A, B) VALUES (2, 3)) + +fun easy () = + queryX' (SELECT MAX(t.A) AS M FROM t) + (fn r => + queryX (SELECT * FROM t WHERE t.A = {[r.M]}) + (fn r => <xml>({[r.T.A]}, {[r.T.B]})</xml>)) + +fun hard id = + queryX' (SELECT t.B AS N FROM t WHERE t.A = {[id]}) + (fn r => + b <- hard r.N; + return <xml>({[id]}, {[r.N]}); {b}</xml>) + +fun doit () = + init (); + b1 <- easy (); + b2 <- hard 1; + return <xml><body> + {b1}<br/> + {b2} + </body></xml> + +fun main () = return <xml><body><form><submit action={doit}/></form></body></xml> diff --git a/tests/nested.urp b/tests/nested.urp new file mode 100644 index 00000000..67cb7e1d --- /dev/null +++ b/tests/nested.urp @@ -0,0 +1,5 @@ +debug +database dbname=nested +sql nested.sql + +nested diff --git a/tests/nested.urs b/tests/nested.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/nested.urs @@ -0,0 +1 @@ +val main : unit -> transaction page |