{ls}
and upd (id : int) =
let
fun save (inputs : $(map snd M.cols)) =
dml (update [map fst M.cols]
(@foldR2 [snd] [colMeta]
[fn cols => $(map (fn t => sql_exp [T = [Id = int] ++ map fst M.cols] [] [] t.1) cols)]
(fn [nm :: Name] [t ::_] [rest ::_] [[nm] ~ rest] =>
fn input col acc => acc ++ {nm =
@sql_inject col.Inject (col.Parse input)})
{} M.fl inputs M.cols)
tab (WHERE T.Id = {[id]}));
ls <- list ();
return
Saved!
{ls}
in
fso <- oneOrNoRows (SELECT tab.{{map fst M.cols}} FROM tab WHERE tab.Id = {[id]});
case fso : (Basis.option {Tab : $(map fst M.cols)}) of
None => return Not found!
| Some fs => return
end
and confirm (id : int) =
let
fun delete () =
dml (DELETE FROM tab WHERE Id = {[id]});
ls <- list ();
return
The deed is done.
{ls}
in
return
Are you sure you want to delete ID #{[id]}?
end
and main () =
ls <- list ();
return {cdata M.title}