Mercurial > urweb
comparison tests/policy.ur @ 1214:648e6b087dfb
Change query_policy to sendClient; all arguments passed to SQL predicates are variables
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 08 Apr 2010 09:57:37 -0400 |
parents | c5bd970e77a5 |
children | 7dfa67560916 |
comparison
equal
deleted
inserted
replaced
1213:e791d93d4616 | 1214:648e6b087dfb |
---|---|
7 table order : { Id : order, Fruit : fruit, Qty : int, Code : int } | 7 table order : { Id : order, Fruit : fruit, Qty : int, Code : int } |
8 PRIMARY KEY Id, | 8 PRIMARY KEY Id, |
9 CONSTRAINT Fruit FOREIGN KEY Fruit REFERENCES fruit(Id) | 9 CONSTRAINT Fruit FOREIGN KEY Fruit REFERENCES fruit(Id) |
10 | 10 |
11 (* Everyone may knows IDs and names. *) | 11 (* Everyone may knows IDs and names. *) |
12 policy query_policy (SELECT fruit.Id, fruit.Nam | 12 policy sendClient (SELECT fruit.Id, fruit.Nam |
13 FROM fruit) | 13 FROM fruit) |
14 | 14 |
15 (* The weight is sensitive information; you must know the secret. *) | 15 (* The weight is sensitive information; you must know the secret. *) |
16 policy query_policy (SELECT fruit.Weight, fruit.Secret | 16 policy sendClient (SELECT fruit.Weight, fruit.Secret |
17 FROM fruit | 17 FROM fruit |
18 WHERE known(fruit.Secret)) | 18 WHERE known(fruit.Secret)) |
19 | 19 |
20 policy query_policy (SELECT order.Id, order.Fruit, order.Qty | 20 policy sendClient (SELECT order.Id, order.Fruit, order.Qty |
21 FROM order, fruit | 21 FROM order, fruit |
22 WHERE order.Fruit = fruit.Id | 22 WHERE order.Fruit = fruit.Id |
23 AND order.Qty = 13) | 23 AND order.Qty = 13) |
24 | 24 |
25 fun fname r = | 25 fun fname r = |
26 x <- queryX (SELECT fruit.Weight | 26 x <- queryX (SELECT fruit.Weight |
27 FROM fruit | 27 FROM fruit |
28 WHERE fruit.Nam = {[r.Nam]} | 28 WHERE fruit.Nam = {[r.Nam]} |