blob: 2691a939e5b3003ef68b021f9a4b23db612aa704 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
fun filter [fs ::: {Type}] [ks] (t : sql_table fs ks) (p : sql_exp [T = fs] [] [] bool) =
(SELECT * FROM t WHERE {p})
table t : { A : int, B : float }
task initialize = fn () =>
dml (INSERT INTO t (A, B) VALUES (1, 2.0));
dml (INSERT INTO t (A, B) VALUES (2, 1.0));
dml (INSERT INTO t (A, B) VALUES (3, 3.0));
dml (INSERT INTO t (A, B) VALUES (4, 4.0));
dml (INSERT INTO t (A, B) VALUES (44, 4.4))
fun main () : transaction page =
r <- queryX (filter t (WHERE t.A > 3))
(fn r => <xml>{[r.T.A]}, {[r.T.B]}; </xml>);
return <xml><body>{r}</body></xml>
|