annotate tests/dbupload.ur @ 2142:3288e3c9948b

Fix XML indentation in Emacs mode The return value of MATCH-STRING is a string. At least on Emacs 25, the comparisons between string and character with EQUAL could never succeed, and so the cases for matching braces were never triggered. GET-TEXT-PROPERTY may return a list rather than an atom (for example, on long lines with whitespace-mode turned on), and this broke the heuristic of looking for the tag face in previous text.
author Julian Squires <julian@cipht.net>
date Mon, 04 May 2015 14:35:07 -0400
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