Mercurial > urweb
annotate caching-tests/bench.ur @ 2298:6e580e319077
Fix condition for installing new cache entries
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 19 Nov 2015 16:02:04 -0500 |
parents | 8be54d7bd06e |
children |
rev | line source |
---|---|
ziv@2290 | 1 table tab : {Id : int, Val : int} PRIMARY KEY Id |
ziv@2290 | 2 |
ziv@2290 | 3 fun check id = |
ziv@2290 | 4 res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]}); |
ziv@2290 | 5 return <xml><body> |
ziv@2293 | 6 Value at {[id]} is |
ziv@2290 | 7 {case res of |
ziv@2293 | 8 None => <xml>unknown</xml> |
ziv@2293 | 9 | Some row => <xml>{[row.Tab.Val]}</xml>}. |
ziv@2290 | 10 </body></xml> |
ziv@2290 | 11 |
ziv@2290 | 12 fun flush id = |
ziv@2290 | 13 dml (UPDATE tab SET Val = Val + 1 WHERE Id = {[id]}); |
ziv@2290 | 14 return <xml><body> |
ziv@2293 | 15 Incremented value at {[id]} (if it exists). |
ziv@2290 | 16 </body></xml> |