view 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
line wrap: on
line source
table foo : {Id : int, Bar : string} PRIMARY KEY Id

(* val query = (SELECT * FROM foo WHERE foo.Bar = "baz") *)
(* val insert = (INSERT INTO foo (Id, Bar) VALUES (42, "baz")) *)

fun main () : transaction page =
    dml (INSERT INTO foo (Id, Bar) VALUES (42, "baz"));
    res <- oneOrNoRows (SELECT foo.Id, foo.Bar
                        FROM foo
                        WHERE foo.Bar = "baz"
                          UNION
                        SELECT *
                        FROM foo
                        WHERE foo.Bar = "qux");
    return
        <xml>
          <body>
            {case res of
                 None => <xml></xml>
               | Some row => <xml>{[row.Foo.Bar]}</xml>}
          </body>
        </xml>