summaryrefslogtreecommitdiff
path: root/caching-tests
diff options
context:
space:
mode:
authorGravatar Ziv Scully <ziv@mit.edu>2015-06-29 01:33:47 -0700
committerGravatar Ziv Scully <ziv@mit.edu>2015-06-29 01:33:47 -0700
commitaa2da68f6bfc3649fcb43afa1b88909ef278ac60 (patch)
tree450157c764ab506a5543e3da8e2a2c0f861f9183 /caching-tests
parent24edb607ef64db1ab12b3d5b9ccd3848c50780d1 (diff)
Refactored a lot and fixed an and/or swap, but still not good on current test.
Diffstat (limited to 'caching-tests')
-rw-r--r--caching-tests/test.ur42
1 files changed, 20 insertions, 22 deletions
diff --git a/caching-tests/test.ur b/caching-tests/test.ur
index 842fd77d..ba3a337d 100644
--- a/caching-tests/test.ur
+++ b/caching-tests/test.ur
@@ -11,29 +11,27 @@ fun cache id =
| Some row => <xml>{[row.Tab.Val]}</xml>}
</body></xml>
+
fun flush id =
- res <- oneOrNoRows (SELECT tab.Val
- FROM tab
- WHERE tab.Id = {[id]});
- (case res of
- None => return () (* dml (INSERT INTO tab (Id, Val) *)
- (* VALUES ({[id]}, 0)) *)
- | Some row => dml (UPDATE tab
- SET Val = {[row.Tab.Val + 1]}
- WHERE Id = {[id + 1]} OR Id = {[id]} (* OR Id = {[id - 1]} *)));
+ dml (UPDATE tab
+ SET Val = 42
+ WHERE Id = {[id]} OR Id = {[id + 1]});
return <xml><body>
- {case res of
- None => <xml>Initialized {[id]}!</xml>
- | Some row => <xml>Incremented {[id]}!</xml>}
+ Changed {[id]}!
</body></xml>
-(* task periodic 5 = *)
-(* fn () => *)
-(* t <- now; *)
-(* let *)
-(* val n = toSeconds t % 2 *)
-(* in *)
-(* dml (UPDATE tab *)
-(* SET Val = 9001 *)
-(* WHERE Id = {[n]} OR Id = {[n+1]}) *)
-(* end *)
+(* fun flush id = *)
+(* res <- oneOrNoRows (SELECT tab.Val *)
+(* FROM tab *)
+(* WHERE tab.Id = {[id]}); *)
+(* (case res of *)
+(* None => dml (INSERT INTO tab (Id, Val) *)
+(* VALUES ({[id]}, 0)) *)
+(* | Some row => dml (UPDATE tab *)
+(* SET Val = {[row.Tab.Val + 1]} *)
+(* WHERE Id = {[id]} OR Id = {[id + 1]})); *)
+(* return <xml><body> *)
+(* {case res of *)
+(* None => <xml>Initialized {[id]}!</xml> *)
+(* | Some row => <xml>Incremented {[id]}!</xml>} *)
+(* </body></xml> *)