comparison demo/view.ur @ 778:7b47fc964a0f

view demo
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 May 2009 15:13:00 -0400
parents
children 669ac5e9a69e
comparison
equal deleted inserted replaced
777:87a7702d681d 778:7b47fc964a0f
1 table t : { A : int }
2 view v = SELECT t.A AS A FROM t WHERE t.A > 7
3
4 fun list (u ::: Type) (_ : fieldsOf u [A = int]) (title : string) (x : u) =
5 xml <- queryX (SELECT * FROM x)
6 (fn r : {X : {A : int}} => <xml><li>{[r.X.A]}</li></xml>);
7 return <xml>
8 <h2>{[title]}</h2>
9 <ul>{xml}</ul>
10 </xml>
11
12 fun main () =
13 listT <- list "T" t;
14 listV <- list "V" v;
15 return <xml><body>
16 {listT}
17 {listV}
18 <br/>
19
20 <form>Insert: <textbox{#A}/> <submit action={ins}/></form>
21 </body></xml>
22
23 and ins r =
24 dml (INSERT INTO t (A) VALUES ({[readError r.A]}));
25 main ()