comparison tests/dbupload2.ur @ 2053:229a299d739d

Add tests/dbupload2.* files tests/dbupload2.sh is a shell script which run the test scenario On my machine the executable segfaults after curl request
author Sergey Mironov <grrwlf@gmail.com>
date Fri, 15 Aug 2014 07:11:31 +0000
parents
children
comparison
equal deleted inserted replaced
2052:15ecf697542b 2053:229a299d739d
1 table t : { Id : int, Blob : blob, MimeType : string }
2 sequence s
3
4 fun getImage id : transaction page =
5 r <- oneRow1 (SELECT t.Blob, t.MimeType
6 FROM t
7 WHERE t.Id = {[id]});
8 returnBlob r.Blob (blessMime r.MimeType)
9
10 fun handle (r : {File:file, Param:string}) =
11 id <- nextval s;
12 dml (INSERT INTO t (Id, Blob, MimeType)
13 VALUES ({[id]}, {[fileData r.File]}, {[fileMimeType r.File]}));
14 debug ("Text is " ^ r.Param);
15 main ()
16
17 and main () : transaction page =
18 x <- queryX1 (SELECT t.Id FROM t)
19 (fn r => <xml><img src={url (getImage r.Id)}/>
20 </xml>);
21 return <xml><body>
22 <form>
23 <upload{#File}/>
24 <textbox{#Param} value="text"/>
25 <submit action={handle}/>
26 </form>
27 <hr/>
28 {x}
29 </body></xml>