aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/sql_option.ur
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sql_option.ur')
-rw-r--r--tests/sql_option.ur22
1 files changed, 22 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/>*)