table t : { Id : int, Blob : option blob, MimeType : string } sequence s fun getImage id : transaction page = r <- oneRow1 (SELECT t.Blob, t.MimeType FROM t WHERE t.Id = {[id]}); case r.Blob of None => error Oh no! | Some blob => returnBlob blob (blessMime r.MimeType) fun main () : transaction page = let fun handle r = id <- nextval s; dml (INSERT INTO t (Id, Blob, MimeType) VALUES ({[id]}, {[if fileMimeType r.File = "image/jpeg" then Some (fileData r.File) else None]}, {[fileMimeType r.File]})); main () in x <- queryX1 (SELECT t.Id FROM t) (fn r =>
); return

{x}
end