Mercurial > urweb
view tests/blob.ur @ 1438:b6df00ed536c
Fix soundness bug in Effectize, which lead to missing effects in event handlers
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 18 Mar 2011 09:46:24 -0400 |
parents | 034eeb099564 |
children | 67ebd30a2283 |
line wrap: on
line source
sequence s table t : { Id : int, Nam : option string, Data : blob, Desc : string, Typ : string } fun see id = r <- oneRow (SELECT t.Data, t.Typ FROM t WHERE t.Id = {[id]}); returnBlob r.T.Data (blessMime r.T.Typ) fun save r = id <- nextval s; dml (INSERT INTO t (Id, Nam, Data, Desc, Typ) VALUES ({[id]}, {[fileName r.Data]}, {[fileData r.Data]}, {[r.Desc]}, {[fileMimeType r.Data]})); main () and main () = ls <- queryX (SELECT t.Id, t.Desc, octet_length(t.Data) AS Len FROM t ORDER BY t.Desc) (fn r => <xml><li><a link={see r.T.Id}>{[r.T.Desc]} ({[r.Len]})</a></li></xml>); return <xml><body> {ls} <br/> <form> <textbox{#Desc}/> <upload{#Data}/> <submit action={save}/> </form> </body></xml>