diff tests/order_by.ur @ 261:ee51e9d35c9b

Monoize ORDER BY
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 16:03:43 -0400
parents 71bafe66dbe1
children bacd0ba869e1
line wrap: on
line diff
--- a/tests/order_by.ur	Sun Aug 31 15:47:32 2008 -0400
+++ b/tests/order_by.ur	Sun Aug 31 16:03:43 2008 -0400
@@ -10,6 +10,26 @@
 val q4 = (SELECT t1.A, t2.D, t1.A < t2.D AS Lt
         FROM t1, t2
         ORDER BY Lt)
-val q5 = (SELECT t1.A, t2.D, t1.A < t2.D AS Lt
+val q5 = (SELECT t1.A, t1.B, t2.D, t1.A < t2.D AS Lt
         FROM t1, t2
         ORDER BY t1.A, Lt, t2.D)
+
+
+datatype list a = Nil | Cons of a * list a
+
+val r1 : transaction (list string) =
+        query q5
+        (fn fs acc => return (Cons (fs.T1.B, acc)))
+        Nil
+
+val r2 : transaction string =
+        ls <- r1;
+        return (case ls of
+                    Nil => "Problem"
+                  | Cons (b, _) => b)
+
+val main : unit -> transaction page = fn () =>
+        s <- r2;
+        return <html><body>
+                {cdata s}
+        </body></html>