Mercurial > urweb
view tests/dbupload.ur @ 1906:0d2fdc2cc46c
Allow building in a separate build directory
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
Makefile.am | 30 +++---
src/c/Makefile.am | 2 +-
src/compiler.mlb | 2 +-
src/sources | 302 +++++++++++++++++++++++++++---------------------------
4 files changed, 168 insertions(+), 168 deletions(-)
author | Anders Kaseorg <andersk@mit.edu> |
---|---|
date | Fri, 22 Nov 2013 09:36:14 -0500 |
parents | 216a3a67ebe3 |
children |
line wrap: on
line source
table t : { Id : int, Blob : blob, MimeType : string } sequence s fun getImage id : transaction page = r <- oneRow1 (SELECT t.Blob, t.MimeType FROM t WHERE t.Id = {[id]}); returnBlob r.Blob (blessMime r.MimeType) fun main () : transaction page = let fun handle r = id <- nextval s; dml (INSERT INTO t (Id, Blob, MimeType) VALUES ({[id]}, {[fileData r.File]}, {[fileMimeType r.File]})); main () in x <- queryX1 (SELECT t.Id FROM t) (fn r => <xml><img src={url (getImage r.Id)}/><br/></xml>); return <xml><body> <form><upload{#File}/> <submit action={handle}/></form> <hr/> {x} </body></xml> end