view tests/equalKnown.ur @ 1280:3d06e0f7a6f3

Initial version of equalKnown working for secret
author Adam Chlipala <adam@chlipala.net>
date Tue, 27 Jul 2010 11:42:30 -0400
parents
children
line wrap: on
line source
type fruit = int
table fruit : { Id : fruit, Nam : string, Weight : float, Secret : string }
  PRIMARY KEY Id,
  CONSTRAINT Nam UNIQUE Nam

policy sendClient (SELECT fruit.Id, fruit.Nam
                   FROM fruit)

policy sendClient (SELECT fruit.Weight
                   FROM fruit
                   WHERE known(fruit.Secret))

policy equalKnown[#Secret] fruit

fun main () =
    x1 <- queryX (SELECT fruit.Id, fruit.Nam, fruit.Weight
                  FROM fruit
                  WHERE fruit.Nam = "apple"
                    AND fruit.Secret = "tasty")
                 (fn x => <xml><li>{[x.Fruit.Id]}: {[x.Fruit.Nam]}, {[x.Fruit.Weight]}</li></xml>);

    return <xml><body>
      <ul>{x1}</ul>
    </body></xml>