summaryrefslogtreecommitdiff
path: root/tests
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
parentd6dbcd83918e1cc3b6f6bba2f2b8e82bb15a6e7b (diff)
Inserted a NULL value
Diffstat (limited to 'tests')
-rw-r--r--tests/sql_option.ur22
-rw-r--r--tests/sql_option.urp5
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