Mercurial > urweb
annotate tests/each.ur @ 1531:7efcf8f4a44a
'-dumpTypes'
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 07 Aug 2011 16:53:06 -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> |