adamc@737: sequence s
adamc@740: table t : { Id : int, Nam : option string, Data : blob, Desc : string, Typ : string }
adamc@737:
adamc@890: fun see id =
adamc@742: r <- oneRow (SELECT t.Data, t.Typ FROM t WHERE t.Id = {[id]});
adamc@742: returnBlob r.T.Data (blessMime r.T.Typ)
adamc@742:
adamc@737: fun save r =
adamc@739: id <- nextval s;
adamc@740: dml (INSERT INTO t (Id, Nam, Data, Desc, Typ)
adamc@740: VALUES ({[id]}, {[fileName r.Data]}, {[fileData r.Data]}, {[r.Desc]}, {[fileMimeType r.Data]}));
adamc@739: main ()
adamc@737:
adamc@742: and main () =
adamc@746: ls <- queryX (SELECT t.Id, t.Desc, octet_length(t.Data) AS Len FROM t ORDER BY t.Desc)
adamc@890: (fn r => {[r.T.Desc]} ({[r.Len]}));
adamc@742: return
adamc@742: {ls}
adamc@742:
adamc@742:
adamc@742:
adamc@742:
adamc@742: