adamc@471: sequence s
adamc@469: table t : { Id : int, Parent : option int, Nam : string }
adamc@715: PRIMARY KEY Id,
adamc@715: CONSTRAINT F FOREIGN KEY Parent REFERENCES t (Id) ON DELETE CASCADE
adamc@469:
adamc@469: open TreeFun.Make(struct
adamc@469: val tab = t
adamc@469: end)
adamc@469:
adamc@469: fun row r =
adamc@471: #{[r.Id]}: {[r.Nam]} [Delete]
adamc@471:
adamc@471:
adamc@469:
adamc@469:
adamc@471: and main () =
adamc@469: xml <- tree row None;
adamc@469: return
adamc@469: {xml}
adamc@471:
adamc@471:
adamc@469:
adamc@471:
adamc@471: and add parent r =
adamc@471: id <- nextval s;
adamc@471: dml (INSERT INTO t (Id, Parent, Nam) VALUES ({[id]}, {[parent]}, {[r.Nam]}));
adamc@471: main ()
adamc@471:
adamc@471: and del id =
adamc@471: dml (DELETE FROM t WHERE Id = {[id]});
adamc@471: main ()