diff tests/policy.ur @ 1205:7cd11380cdf1

WHERE-dependent checking
author Adam Chlipala <adamc@hcoop.net>
date Sun, 04 Apr 2010 17:18:41 -0400
parents 7af5e2af64f4
children 772760df4c4c
line wrap: on
line diff
--- a/tests/policy.ur	Sun Apr 04 17:11:22 2010 -0400
+++ b/tests/policy.ur	Sun Apr 04 17:18:41 2010 -0400
@@ -8,8 +8,11 @@
   PRIMARY KEY Id,
   CONSTRAINT Fruit FOREIGN KEY Fruit REFERENCES fruit(Id)
 
-policy query_policy (SELECT fruit.Id, fruit.Nam, fruit.Weight FROM fruit)
-policy query_policy (SELECT order.Id, order.Fruit, order.Qty FROM order)
+policy query_policy (SELECT fruit.Id, fruit.Nam, fruit.Weight
+                     FROM fruit)
+policy query_policy (SELECT order.Id, order.Fruit, order.Qty
+                     FROM order, fruit
+                     WHERE order.Fruit = fruit.Id)
 
 fun main () =
     x1 <- queryX (SELECT fruit.Id, fruit.Nam
@@ -18,7 +21,7 @@
 
     x2 <- queryX (SELECT fruit.Nam, order.Qty
                   FROM fruit, order
-                  WHERE order.Fruit = fruit.Id)
+                  WHERE fruit.Id = order.Fruit)
                  (fn x => <xml><li>{[x.Fruit.Nam]}: {[x.Order.Qty]}</li></xml>);
 
     return <xml><body>