annotate tests/each.ur @ 2179:4f4ae5c92434

New release
author Adam Chlipala <adam@chlipala.net>
date Sun, 18 Oct 2015 10:34:24 -0400
parents ccf1d445b794
children
rev   line source
adam@1355 1 sequence s
adam@1355 2 table t : { Id : int, S1 : string, S2:string, S3:string, S4:string }
adam@1355 3
adam@1355 4 fun each (n : int, (f : unit -> transaction unit)) = if n > 0 then f (); each ((n-1),f) else return ()
adam@1355 5
adam@1355 6 fun fill () =
adam@1355 7 dml (DELETE FROM t WHERE 1=1);
adam@1355 8 each (1,( fn () =>
adam@1355 9 (nv <- nextval s;
adam@1355 10 (dml (INSERT INTO t (Id, S1, S2, S3, S4) VALUES ({[nv]}, {["S1"]}, {["S2"]}, {["S3"]}, {["S4"]}))))
adam@1355 11 ));
adam@1355 12 return <xml>done</xml>
adam@1355 13
adam@1355 14 fun main () = return <xml><body>
adam@1355 15 <form><submit action={fill} value="fill"/></form>
adam@1355 16 </body></xml>