blob: a23ae2ac8c78a07c03595e5c03e664cce9e52e0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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>
|