aboutsummaryrefslogtreecommitdiffhomepage
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
commit0a10b5b7d2bbdcbfec723176b2a31d6b4c6d34d1 (patch)
tree3dc7245cbdb2c517bb9676d83860e4b48f64026a /tests/sql_option.ur
parentd6dbcd83918e1cc3b6f6bba2f2b8e82bb15a6e7b (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/>*)