Mercurial > urweb
view tests/policy.ur @ 1892:907a82a44f01
Add missing inter-library dependencies
This is needed, at least on recent Ubuntu, to fix these linker errors
when compiling any Ur/Web application:
liburweb.so: undefined reference to `lround'
liburweb.so: undefined reference to `ceil'
liburweb.so: undefined reference to `RAND_bytes'
liburweb.so: undefined reference to `DES_fcrypt'
liburweb.so: undefined reference to `SHA256_Init'
liburweb.so: undefined reference to `SHA256_Final'
liburweb.so: undefined reference to `SHA256_Update'
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
src/c/Makefile.am | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
author | Anders Kaseorg <andersk@mit.edu> |
---|---|
date | Thu, 21 Nov 2013 14:32:11 -0500 |
parents | d5ecceb7d1a1 |
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 type order = int table order : { Id : order, Fruit : fruit, Qty : int, Code : int } PRIMARY KEY Id, CONSTRAINT Fruit FOREIGN KEY Fruit REFERENCES fruit(Id) (* Everyone may knows IDs and names. *) policy sendClient (SELECT fruit.Id, fruit.Nam FROM fruit) (* The weight is sensitive information; you must know the secret. *) policy sendClient (SELECT fruit.Weight, fruit.Secret FROM fruit WHERE known(fruit.Secret)) policy sendClient (SELECT order.Id, order.Fruit, order.Qty FROM order, fruit WHERE order.Fruit = fruit.Id AND order.Qty = 13) fun fname r = x <- queryX (SELECT fruit.Weight FROM fruit WHERE fruit.Nam = {[r.Nam]} AND fruit.Secret = {[r.Secret]} AND fruit.Weight <> 3.14 AND fruit.Weight < 100.0 AND fruit.Weight <= 200.1 AND fruit.Weight > 1.23 AND fruit.Weight >= 1.24) (fn r => <xml>Weight is {[r.Fruit.Weight]}</xml>); return <xml><body> {x} </body></xml> fun main () = x1 <- queryX (SELECT fruit.Id, fruit.Nam FROM fruit WHERE fruit.Nam = "apple") (fn x => <xml><li>{[x.Fruit.Id]}: {[x.Fruit.Nam]}</li></xml>); x2 <- queryX (SELECT fruit.Nam, order.Qty FROM fruit, order WHERE fruit.Id = order.Fruit AND order.Qty = 13) (fn x => <xml><li>{[x.Fruit.Nam]}: {[x.Order.Qty]}</li></xml>); ro <- oneOrNoRows (SELECT fruit.Id, fruit.Nam FROM fruit); return <xml><body> <ul>{x1}</ul> <ul>{x2}</ul> {case ro of None => <xml>None</xml> | Some _ => <xml>Some</xml>} <form> Fruit name: <textbox{#Nam}/><br/> Secret: <textbox{#Secret}/><br/> <submit action={fname}/> </form> </body></xml>