sequence s table t : { Id : int, Parent : option int, Nam : string } open TreeFun.Make(struct val tab = t end) fun row r = #{[r.Id]}: {[r.Nam]} [Delete]
Add child:
and main () = xml <- tree row None; return {xml}
Add a top-level node:
and add parent r = id <- nextval s; dml (INSERT INTO t (Id, Parent, Nam) VALUES ({[id]}, {[parent]}, {[r.Nam]})); main () and del id = dml (DELETE FROM t WHERE Id = {[id]}); main ()