Mercurial > urweb
annotate 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 |
rev | line source |
---|---|
adamc@467 | 1 table t : { O : option int } |
adamc@467 | 2 |
adamc@467 | 3 fun addNull () = |
adamc@467 | 4 dml (INSERT INTO t (O) VALUES (NULL)); |
adamc@467 | 5 return <xml>Done</xml> |
adamc@467 | 6 |
adamc@467 | 7 (*fun add42 () = |
adamc@467 | 8 dml (INSERT INTO t (O) VALUES (42)); |
adamc@467 | 9 return <xml>Done</xml>*) |
adamc@467 | 10 |
adamc@467 | 11 fun main () : transaction page = |
adamc@467 | 12 xml <- queryX (SELECT * FROM t) |
adamc@467 | 13 (fn r => case r.T.O of |
adamc@467 | 14 None => <xml>Nada<br/></xml> |
adamc@467 | 15 | Some n => <xml>Num: {[n]}<br/></xml>); |
adamc@467 | 16 return <xml><body> |
adamc@467 | 17 {xml} |
adamc@467 | 18 |
adamc@467 | 19 <a link={addNull ()}>Add a null</a><br/> |
adamc@467 | 20 </body></xml> |
adamc@467 | 21 |
adamc@467 | 22 (* <a link={add42 ()}>Add a 42</a><br/>*) |