annotate sqlcache-tests/test.ur @ 2202:606af2c9b828

Identifies tables read or touched by queries.
author Ziv Scully <ziv@mit.edu>
date Sat, 08 Mar 2014 05:06:22 -0500
parents
children
rev   line source
ziv@2202 1 table foo : {Id : int, Bar : string} PRIMARY KEY Id
ziv@2202 2
ziv@2202 3 (* val query = (SELECT * FROM foo WHERE foo.Bar = "baz") *)
ziv@2202 4 (* val insert = (INSERT INTO foo (Id, Bar) VALUES (42, "baz")) *)
ziv@2202 5
ziv@2202 6 fun main () : transaction page =
ziv@2202 7 dml (INSERT INTO foo (Id, Bar) VALUES (42, "baz"));
ziv@2202 8 res <- oneOrNoRows (SELECT foo.Id, foo.Bar
ziv@2202 9 FROM foo
ziv@2202 10 WHERE foo.Bar = "baz"
ziv@2202 11 UNION
ziv@2202 12 SELECT *
ziv@2202 13 FROM foo
ziv@2202 14 WHERE foo.Bar = "qux");
ziv@2202 15 return
ziv@2202 16 <xml>
ziv@2202 17 <body>
ziv@2202 18 {case res of
ziv@2202 19 None => <xml></xml>
ziv@2202 20 | Some row => <xml>{[row.Foo.Bar]}</xml>}
ziv@2202 21 </body>
ziv@2202 22 </xml>