Mercurial > urweb
annotate tests/equalKnown.ur @ 1281:60e19545841b
equalAny policies
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 27 Jul 2010 12:12:08 -0400 |
parents | 3d06e0f7a6f3 |
children |
rev | line source |
---|---|
adam@1280 | 1 type fruit = int |
adam@1280 | 2 table fruit : { Id : fruit, Nam : string, Weight : float, Secret : string } |
adam@1280 | 3 PRIMARY KEY Id, |
adam@1280 | 4 CONSTRAINT Nam UNIQUE Nam |
adam@1280 | 5 |
adam@1280 | 6 policy sendClient (SELECT fruit.Id, fruit.Nam |
adam@1280 | 7 FROM fruit) |
adam@1280 | 8 |
adam@1280 | 9 policy sendClient (SELECT fruit.Weight |
adam@1280 | 10 FROM fruit |
adam@1280 | 11 WHERE known(fruit.Secret)) |
adam@1280 | 12 |
adam@1280 | 13 policy equalKnown[#Secret] fruit |
adam@1280 | 14 |
adam@1280 | 15 fun main () = |
adam@1280 | 16 x1 <- queryX (SELECT fruit.Id, fruit.Nam, fruit.Weight |
adam@1280 | 17 FROM fruit |
adam@1280 | 18 WHERE fruit.Nam = "apple" |
adam@1280 | 19 AND fruit.Secret = "tasty") |
adam@1280 | 20 (fn x => <xml><li>{[x.Fruit.Id]}: {[x.Fruit.Nam]}, {[x.Fruit.Weight]}</li></xml>); |
adam@1280 | 21 |
adam@1280 | 22 return <xml><body> |
adam@1280 | 23 <ul>{x1}</ul> |
adam@1280 | 24 </body></xml> |