comparison tests/query.ur @ 748:5f9b9972e6b8

Switch to using sql_from_items
author Adam Chlipala <adamc@hcoop.net>
date Tue, 28 Apr 2009 09:45:17 -0400
parents f8d9395575ec
children
comparison
equal deleted inserted replaced
747:e42f08f96eb5 748:5f9b9972e6b8
4 datatype list a = Nil | Cons of a * list a 4 datatype list a = Nil | Cons of a * list a
5 5
6 val q1 = (SELECT * FROM t1) 6 val q1 = (SELECT * FROM t1)
7 7
8 val r1 : transaction (list {A : int, B : string, C : float, D : bool}) = 8 val r1 : transaction (list {A : int, B : string, C : float, D : bool}) =
9 query q1 9 query q1
10 (fn fs acc => return (Cons (fs.T1, acc))) 10 (fn fs acc => return (Cons (fs.T1, acc)))
11 Nil 11 Nil
12 12
13 val r2 : transaction string = 13 val r2 : transaction string =
14 ls <- r1; 14 ls <- r1;
15 return (case ls of 15 return (case ls of
16 Nil => "Problem" 16 Nil => "Problem"
17 | Cons ({B = b, ...}, _) => b) 17 | Cons ({B = b, ...}, _) => b)
18 18
19 val main : unit -> transaction page = fn () => 19 fun main () : transaction page =
20 s <- r2; 20 s <- r2;
21 return <html><body> 21 return <xml><body>
22 {cdata s} 22 {cdata s}
23 </body></html> 23 </body></xml>