comparison caching-tests/test.ur @ 2269:f7bc7c11a656

Make SQL caches use more of the pure caching machinery, but it's brittle.
author Ziv Scully <ziv@mit.edu>
date Thu, 15 Oct 2015 00:52:04 -0400
parents 200a7ed4343b
children a3cac6cea625
comparison
equal deleted inserted replaced
2268:bc1ef958d801 2269:f7bc7c11a656
7 return <xml><body> 7 return <xml><body>
8 Reading {[id]}. 8 Reading {[id]}.
9 {case res of 9 {case res of
10 None => <xml>?</xml> 10 None => <xml>?</xml>
11 | Some row => <xml>{[row.Tab.Val]}</xml>} 11 | Some row => <xml>{[row.Tab.Val]}</xml>}
12 </body></xml>
13
14 fun cache2 id v =
15 res <- oneOrNoRows (SELECT tab.Val
16 FROM tab
17 WHERE tab.Id = {[id]} AND tab.Val = {[v]});
18 return <xml><body>
19 Reading {[id]}.
20 {case res of
21 None => <xml>Nope, that's not it.</xml>
22 | Some _ => <xml>Hooray! You guessed it!</xml>}
12 </body></xml> 23 </body></xml>
13 24
14 fun flush id = 25 fun flush id =
15 dml (UPDATE tab 26 dml (UPDATE tab
16 SET Val = Val * (Id + 2) / Val - 3 27 SET Val = Val * (Id + 2) / Val - 3