table tab : {Id : int, Val : int} PRIMARY KEY Id
fun check id =
res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]});
return
Value at {[id]} is
{case res of
None => unknown
| Some row => {[row.Tab.Val]}}.
fun flush id =
dml (UPDATE tab SET Val = Val + 1 WHERE Id = {[id]});
return
Incremented value at {[id]} (if it exists).