Mercurial > urweb
annotate demo/constraints.ur @ 1909:659d1f4e95bf
make dist: Use fewer wildcards
The remaining ones only work by accident:
http://www.gnu.org/software/automake/manual/html_node/Wildcards.html
and they have some practical problems too (we don?t really want to
distribute include/urweb/config.h or src/config.sml), but this is
enough for now to pass ?make distcheck? as long as we don?t run it
from a separate build directory.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
Makefile.am | 6 +++---
src/c/Makefile.am | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
author | Anders Kaseorg <andersk@mit.edu> |
---|---|
date | Fri, 22 Nov 2013 09:36:14 -0500 |
parents | 74a090ff296e |
children |
rev | line source |
---|---|
adamc@773 | 1 table t : { Id : int, Nam : string, Parent : option int } |
adamc@773 | 2 PRIMARY KEY Id, |
adamc@773 | 3 CONSTRAINT Nam UNIQUE Nam, |
adamc@773 | 4 CONSTRAINT Id CHECK Id >= 0, |
adamc@773 | 5 CONSTRAINT Parent FOREIGN KEY Parent REFERENCES t(Id) |
adamc@773 | 6 |
adamc@773 | 7 fun main () = |
adamc@773 | 8 list <- queryX (SELECT * FROM t) |
adamc@773 | 9 (fn r => <xml><tr> |
adamc@773 | 10 <td>{[r.T.Id]}</td> |
adamc@773 | 11 <td>{[r.T.Nam]}</td> |
adamc@773 | 12 <td>{case r.T.Parent of |
adamc@773 | 13 None => <xml>NULL</xml> |
adamc@773 | 14 | Some id => <xml>{[id]}</xml>}</td> |
adamc@773 | 15 </tr></xml>); |
adamc@773 | 16 return <xml><body> |
adamc@773 | 17 <table> |
adamc@773 | 18 <tr> <th>Id</th> <th>Name</th> <th>Parent</th> </tr> |
adamc@773 | 19 {list} |
adamc@773 | 20 </table> |
adamc@773 | 21 |
adamc@773 | 22 <form> |
adamc@773 | 23 <table> |
adamc@773 | 24 <tr> <th>Id:</th> <td><textbox{#Id}/></td> </tr> |
adamc@773 | 25 <tr> <th>Name:</th> <td><textbox{#Nam}/></td> </tr> |
adamc@773 | 26 <tr> <th>Parent:</th> <td><textbox{#Parent}/></td> </tr> |
adamc@773 | 27 <tr> <th/> <td><submit action={add}/></td> </tr> |
adamc@773 | 28 </table> |
adamc@773 | 29 </form> |
adamc@773 | 30 </body></xml> |
adamc@773 | 31 |
adamc@773 | 32 and add r = |
adamc@773 | 33 dml (INSERT INTO t (Id, Nam, Parent) |
adamc@773 | 34 VALUES ({[readError r.Id]}, {[r.Nam]}, |
adamc@773 | 35 {[case r.Parent of |
adamc@773 | 36 "" => None |
adamc@773 | 37 | s => Some (readError s)]})); |
adamc@773 | 38 main () |