annotate tests/dbupload.ur @ 1909:659d1f4e95bf

make dist: Use fewer wildcards The remaining ones only work by accident: http://www.gnu.org/software/automake/manual/html_node/Wildcards.html and they have some practical problems too (we don?t really want to distribute include/urweb/config.h or src/config.sml), but this is enough for now to pass ?make distcheck? as long as we don?t run it from a separate build directory. Signed-off-by: Anders Kaseorg <andersk@mit.edu> --- Makefile.am | 6 +++--- src/c/Makefile.am | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
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