adamc@1204: type fruit = int
adamc@1204: table fruit : { Id : fruit, Nam : string, Weight : float, Secret : string }
adamc@1204: PRIMARY KEY Id,
adamc@1204: CONSTRAINT Nam UNIQUE Nam
adamc@1204:
adamc@1204: type order = int
adamc@1204: table order : { Id : order, Fruit : fruit, Qty : int, Code : int }
adamc@1204: PRIMARY KEY Id,
adamc@1204: CONSTRAINT Fruit FOREIGN KEY Fruit REFERENCES fruit(Id)
adamc@1199:
adamc@1203: policy query_policy (SELECT fruit.Id, fruit.Nam, fruit.Weight FROM fruit)
adamc@1204: policy query_policy (SELECT order.Id, order.Fruit, order.Qty FROM order)
adamc@1200:
adamc@1200: fun main () =
adamc@1204: x1 <- queryX (SELECT fruit.Id, fruit.Nam
adamc@1204: FROM fruit)
adamc@1204: (fn x => {[x.Fruit.Id]}: {[x.Fruit.Nam]});
adamc@1204:
adamc@1204: x2 <- queryX (SELECT fruit.Nam, order.Qty
adamc@1204: FROM fruit, order
adamc@1204: WHERE order.Fruit = fruit.Id)
adamc@1204: (fn x => {[x.Fruit.Nam]}: {[x.Order.Qty]});
adamc@1200:
adamc@1200: return
adamc@1204:
adamc@1204:
adamc@1200: