Mercurial > urweb
view caching-tests/test.ur @ 2228:25c94de06e3c
New mouse events oncontextmenu, onmouseenter, and onmouseleave.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Tue, 07 Apr 2015 14:18:53 -0400 |
parents | 6262dabc08d6 |
children | 2f7ed04332a0 |
line wrap: on
line source
table tab : {Id : int, Val : int} PRIMARY KEY Id fun cache id = res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]}); return <xml><body> Reading {[id]}. {case res of None => <xml>?</xml> | Some row => <xml>{[row.Tab.Val]}</xml>} </body></xml> fun flush id = res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]}); (case res of None => dml (INSERT INTO tab (Id, Val) VALUES ({[id]}, 0)) | Some row => dml (UPDATE tab SET Val = {[row.Tab.Val + 1]} WHERE Id = {[id]})); return <xml><body> {case res of None => <xml>Initialized {[id]}!</xml> | Some row => <xml>Incremented {[id]}!</xml>} </body></xml>