summaryrefslogtreecommitdiff
path: root/tests/equalKnown.ur
blob: 4af324904504e41d22f800193b6d9be19a6ace2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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>