diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sql_option.ur | 22 | ||||
-rw-r--r-- | tests/sql_option.urp | 5 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/sql_option.ur b/tests/sql_option.ur new file mode 100644 index 00000000..257f8c55 --- /dev/null +++ b/tests/sql_option.ur @@ -0,0 +1,22 @@ +table t : { O : option int } + +fun addNull () = + dml (INSERT INTO t (O) VALUES (NULL)); + return <xml>Done</xml> + +(*fun add42 () = + dml (INSERT INTO t (O) VALUES (42)); + return <xml>Done</xml>*) + +fun main () : transaction page = + xml <- queryX (SELECT * FROM t) + (fn r => case r.T.O of + None => <xml>Nada<br/></xml> + | Some n => <xml>Num: {[n]}<br/></xml>); + return <xml><body> + {xml} + + <a link={addNull ()}>Add a null</a><br/> + </body></xml> + +(* <a link={add42 ()}>Add a 42</a><br/>*) diff --git a/tests/sql_option.urp b/tests/sql_option.urp new file mode 100644 index 00000000..543c32a8 --- /dev/null +++ b/tests/sql_option.urp @@ -0,0 +1,5 @@ +debug +database dbname=option +sql option.sql + +sql_option |