annotate tests/dbupload.ur @ 1905:cd1cfecc8c72

Remove autogenerated config.h.in from version control Signed-off-by: Anders Kaseorg <andersk@mit.edu> --- .hgignore | 1 + include/urweb/config.h.in | 104 ---------------------------------------------- 2 files changed, 1 insertion(+), 104 deletions(-) delete mode 100644 include/urweb/config.h.in
author Anders Kaseorg <andersk@mit.edu>
date Fri, 22 Nov 2013 09:36:14 -0500
parents 216a3a67ebe3
children
rev   line source
adam@1867 1 table t : { Id : int, Blob : blob, MimeType : string }
adam@1867 2 sequence s
adam@1867 3
adam@1867 4 fun getImage id : transaction page =
adam@1867 5 r <- oneRow1 (SELECT t.Blob, t.MimeType
adam@1867 6 FROM t
adam@1867 7 WHERE t.Id = {[id]});
adam@1867 8 returnBlob r.Blob (blessMime r.MimeType)
adam@1867 9
adam@1867 10 fun main () : transaction page =
adam@1867 11 let
adam@1867 12 fun handle r =
adam@1867 13 id <- nextval s;
adam@1867 14 dml (INSERT INTO t (Id, Blob, MimeType)
adam@1867 15 VALUES ({[id]}, {[fileData r.File]}, {[fileMimeType r.File]}));
adam@1867 16 main ()
adam@1867 17 in
adam@1867 18 x <- queryX1 (SELECT t.Id FROM t)
adam@1867 19 (fn r => <xml><img src={url (getImage r.Id)}/><br/></xml>);
adam@1867 20 return <xml><body>
adam@1867 21 <form><upload{#File}/> <submit action={handle}/></form>
adam@1867 22 <hr/>
adam@1867 23 {x}
adam@1867 24 </body></xml>
adam@1867 25 end