diff caching-tests/test.ur @ 2235:0aae15c2a05a

Refactored a lot and fixed an and/or swap, but still not good on current test.
author Ziv Scully <ziv@mit.edu>
date Mon, 29 Jun 2015 01:33:47 -0700
parents 2f7ed04332a0
children fab8c1f131a5
line wrap: on
line diff
--- a/caching-tests/test.ur	Sun Jun 28 12:46:51 2015 -0700
+++ b/caching-tests/test.ur	Mon Jun 29 01:33:47 2015 -0700
@@ -11,29 +11,27 @@
          | 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> *)