comparison tests/sql_option.ur @ 467:3f1b9231a37b

Inserted a NULL value
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Nov 2008 15:37:38 -0500
parents
children 4efab85405be
comparison
equal deleted inserted replaced
466:1626dcba13ee 467:3f1b9231a37b
1 table t : { O : option int }
2
3 fun addNull () =
4 dml (INSERT INTO t (O) VALUES (NULL));
5 return <xml>Done</xml>
6
7 (*fun add42 () =
8 dml (INSERT INTO t (O) VALUES (42));
9 return <xml>Done</xml>*)
10
11 fun main () : transaction page =
12 xml <- queryX (SELECT * FROM t)
13 (fn r => case r.T.O of
14 None => <xml>Nada<br/></xml>
15 | Some n => <xml>Num: {[n]}<br/></xml>);
16 return <xml><body>
17 {xml}
18
19 <a link={addNull ()}>Add a null</a><br/>
20 </body></xml>
21
22 (* <a link={add42 ()}>Add a 42</a><br/>*)