blob: 2661bd0e2bcf7393742d1b2c6fec3172c13c5ec5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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>
|