annotate sqlcache-tests/test.ur @ 2204:01c8aceac480

Finishes initial prototype, caching parameterless pages with table-match-based invalidation. Still has problems parsing non-Postgres SQL dialects properly.
author Ziv Scully <ziv@mit.edu>
date Tue, 27 May 2014 21:14:13 -0400
parents 606af2c9b828
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>