adamc@737: sequence s
adamc@737: table t : { Id : int, Nam : option string, Data : blob, Desc : string }
adamc@737:
adamc@737: fun save r =
adamc@737: if numFiles r.Data <> 1 then
adamc@737: error Please submit exactly one file.
adamc@737: else
adamc@737: let
adamc@737: val f = fileNum r.Data 0
adamc@737: in
adamc@737: id <- nextval s;
adamc@737: dml (INSERT INTO t (Id, Nam, Data, Desc) VALUES ({[id]}, {[fileName f]}, {[fileData f]}, {[r.Desc]}));
adamc@737: main ()
adamc@737: end
adamc@737:
adamc@737: and main () = return
adamc@737:
adamc@737: