view caching-tests/bench.ur @ 2297:6d56080f495c

Fix a read-after-free bug using a timestamp check
author Adam Chlipala <adam@chlipala.net>
date Thu, 19 Nov 2015 13:18:58 -0500
parents 8be54d7bd06e
children
line wrap: on
line source
table tab : {Id : int, Val : int} PRIMARY KEY Id

fun check id =
    res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]});
    return <xml><body>
      Value at {[id]} is
      {case res of
           None => <xml>unknown</xml>
         | Some row => <xml>{[row.Tab.Val]}</xml>}.
    </body></xml>

fun flush id =
    dml (UPDATE tab SET Val = Val + 1 WHERE Id = {[id]});
    return <xml><body>
      Incremented value at {[id]} (if it exists).
    </body></xml>