summaryrefslogtreecommitdiff
path: root/tests/sql_option.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-06 15:37:38 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-06 15:37:38 -0500
commit2b028daf3ff279b9c68301c031588ab042edddf5 (patch)
tree3dc7245cbdb2c517bb9676d83860e4b48f64026a /tests/sql_option.ur
parent27e3c3ba965513dcb3e447cccf6e77ce8c63e90d (diff)
Inserted a NULL value
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/>*)