annotate caching-tests/test.ur @ 2209:0ca11d57c175

Cleans up interface (it's now a command line option) and renames project to "sqlcache" in the all-one-word style. Still has issues to do with concurrency, retrying transactions, and foreign function calls that either rely on state or have side effects.
author Ziv Scully <ziv@mit.edu>
date Sat, 31 May 2014 03:08:16 -0400
parents 01c8aceac480
children 365727ff68f4
rev   line source
ziv@2203 1 table foo01 : {Id : int, Bar : string} PRIMARY KEY Id
ziv@2203 2 table foo10 : {Id : int, Bar : string} PRIMARY KEY Id
ziv@2203 3
ziv@2204 4 fun flush01 () : transaction page =
ziv@2204 5 dml (UPDATE foo01 SET Bar = "baz01" WHERE Id = 42);
ziv@2204 6 return <xml><body>
ziv@2204 7 Flushed 1!
ziv@2204 8 </body></xml>
ziv@2203 9
ziv@2204 10 fun flush10 () : transaction page =
ziv@2204 11 dml (UPDATE foo10 SET Bar = "baz10" WHERE Id = 42);
ziv@2204 12 return <xml><body>
ziv@2204 13 Flushed 2!
ziv@2204 14 </body></xml>
ziv@2203 15
ziv@2204 16 fun flush11 () : transaction page =
ziv@2204 17 dml (UPDATE foo01 SET Bar = "baz11" WHERE Id = 42);
ziv@2204 18 dml (UPDATE foo10 SET Bar = "baz11" WHERE Id = 42);
ziv@2204 19 return <xml><body>
ziv@2204 20 Flushed 1 and 2!
ziv@2204 21 </body></xml>
ziv@2203 22
ziv@2203 23 fun cache01 () : transaction page =
ziv@2204 24 res <- oneOrNoRows (SELECT foo01.Bar FROM foo01 WHERE foo01.Id = 42);
ziv@2204 25 return <xml><body>
ziv@2204 26 Reading 1.
ziv@2204 27 {case res of
ziv@2204 28 None => <xml></xml>
ziv@2204 29 | Some row => <xml>{[row.Foo01.Bar]}</xml>}
ziv@2204 30 </body></xml>
ziv@2203 31
ziv@2203 32 fun cache10 () : transaction page =
ziv@2204 33 res <- oneOrNoRows (SELECT foo10.Bar FROM foo10 WHERE foo10.Id = 42);
ziv@2204 34 return <xml><body>
ziv@2204 35 Reading 2.
ziv@2204 36 {case res of
ziv@2204 37 None => <xml></xml>
ziv@2204 38 | Some row => <xml>{[row.Foo10.Bar]}</xml>}
ziv@2204 39 </body></xml>
ziv@2203 40
ziv@2203 41 fun cache11 () : transaction page =
ziv@2204 42 res <- oneOrNoRows (SELECT foo01.Bar FROM foo01 WHERE foo01.Id = 42);
ziv@2204 43 bla <- oneOrNoRows (SELECT foo10.Bar FROM foo10 WHERE foo10.Id = 42);
ziv@2204 44 return <xml><body>
ziv@2204 45 Reading 1 and 2.
ziv@2204 46 {case res of
ziv@2204 47 None => <xml></xml>
ziv@2204 48 | Some row => <xml>{[row.Foo01.Bar]}</xml>}
ziv@2204 49 {case bla of
ziv@2204 50 None => <xml></xml>
ziv@2204 51 | Some row => <xml>{[row.Foo10.Bar]}</xml>}
ziv@2204 52 </body></xml>