annotate demo/tree.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 d069b193ed6b
children
rev   line source
adamc@471 1 sequence s
adamc@469 2 table t : { Id : int, Parent : option int, Nam : string }
adamc@715 3 PRIMARY KEY Id,
adamc@715 4 CONSTRAINT F FOREIGN KEY Parent REFERENCES t (Id) ON DELETE CASCADE
adamc@469 5
adamc@469 6 open TreeFun.Make(struct
adamc@1078 7 con id = #Id
adamc@1078 8 con parent = #Parent
adamc@1079 9 val tab = t
adamc@469 10 end)
adamc@469 11
adamc@469 12 fun row r = <xml>
adamc@732 13 #{[r.Id]}: {[r.Nam]} <form><submit action={del r.Id} value="Delete"/></form>
adamc@471 14
adamc@471 15 <form>
adamc@471 16 Add child: <textbox{#Nam}/> <submit action={add (Some r.Id)}/>
adamc@471 17 </form>
adamc@469 18 </xml>
adamc@469 19
adamc@471 20 and main () =
adamc@469 21 xml <- tree row None;
adamc@469 22 return <xml><body>
adamc@469 23 {xml}
adamc@471 24
adamc@471 25 <form>
adamc@471 26 Add a top-level node: <textbox{#Nam}/> <submit action={add None}/>
adamc@471 27 </form>
adamc@469 28 </body></xml>
adamc@471 29
adamc@471 30 and add parent r =
adamc@471 31 id <- nextval s;
adamc@471 32 dml (INSERT INTO t (Id, Parent, Nam) VALUES ({[id]}, {[parent]}, {[r.Nam]}));
adamc@471 33 main ()
adamc@471 34
adamc@732 35 and del id () =
adamc@471 36 dml (DELETE FROM t WHERE Id = {[id]});
adamc@471 37 main ()