Mercurial > urweb
diff caching-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 | 39faa4a037f4 |
children | 0ca11d57c175 |
line wrap: on
line diff
--- a/caching-tests/test.ur Tue Mar 25 02:04:06 2014 -0400 +++ b/caching-tests/test.ur Tue May 27 21:14:13 2014 -0400 @@ -1,81 +1,53 @@ table foo01 : {Id : int, Bar : string} PRIMARY KEY Id table foo10 : {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 flush01 () : transaction page = + dml (INSERT INTO foo01 (Id, Bar) VALUES (42, "baz01")); + dml (UPDATE foo01 SET Bar = "baz01" WHERE Id = 42); + return <xml><body> + Flushed 1! + </body></xml> -fun flush01 () : transaction page= - dml (INSERT INTO foo01 (Id, Bar) VALUES (42, "baz")); - return - <xml> - <body> - Flushed 1! - </body> - </xml> +fun flush10 () : transaction page = + dml (UPDATE foo10 SET Bar = "baz10" WHERE Id = 42); + return <xml><body> + Flushed 2! + </body></xml> -fun flush10 () : transaction page= - dml (INSERT INTO foo10 (Id, Bar) VALUES (42, "baz")); - return - <xml> - <body> - Flushed 2! - </body> - </xml> - -fun flush11 () : transaction page= - dml (INSERT INTO foo01 (Id, Bar) VALUES (42, "baz")); - dml (INSERT INTO foo10 (Id, Bar) VALUES (42, "baz")); - return - <xml> - <body> - Flushed 1 and 2! - </body> - </xml> +fun flush11 () : transaction page = + dml (UPDATE foo01 SET Bar = "baz11" WHERE Id = 42); + dml (UPDATE foo10 SET Bar = "baz11" WHERE Id = 42); + return <xml><body> + Flushed 1 and 2! + </body></xml> fun cache01 () : transaction page = - res <- oneOrNoRows (SELECT foo01.Id, foo01.Bar - FROM foo01 - WHERE foo01.Bar = "baz"); - return - <xml> - <body> - Reading 1. - {case res of - None => <xml></xml> - | Some row => <xml>{[row.Foo01.Bar]}</xml>} - </body> - </xml> + res <- oneOrNoRows (SELECT foo01.Bar FROM foo01 WHERE foo01.Id = 42); + return <xml><body> + Reading 1. + {case res of + None => <xml></xml> + | Some row => <xml>{[row.Foo01.Bar]}</xml>} + </body></xml> fun cache10 () : transaction page = - res <- oneOrNoRows (SELECT foo10.Id, foo10.Bar - FROM foo10 - WHERE foo10.Bar = "baz"); - return - <xml> - <body> - Reading 2. - {case res of - None => <xml></xml> - | Some row => <xml>{[row.Foo10.Bar]}</xml>} - </body> - </xml> + res <- oneOrNoRows (SELECT foo10.Bar FROM foo10 WHERE foo10.Id = 42); + return <xml><body> + Reading 2. + {case res of + None => <xml></xml> + | Some row => <xml>{[row.Foo10.Bar]}</xml>} + </body></xml> fun cache11 () : transaction page = - res <- oneOrNoRows (SELECT foo01.Id, foo01.Bar - FROM foo01 - WHERE foo01.Bar = "baz"); - bla <- oneOrNoRows (SELECT foo10.Id, foo10.Bar - FROM foo10 - WHERE foo10.Bar = "baz"); - return - <xml> - <body> - Reading 1 and 2. - {case res of - None => <xml></xml> - | Some row => <xml>{[row.Foo01.Bar]}</xml>} - {case bla of - None => <xml></xml> - | Some row => <xml>{[row.Foo10.Bar]}</xml>} - </body> - </xml> + res <- oneOrNoRows (SELECT foo01.Bar FROM foo01 WHERE foo01.Id = 42); + bla <- oneOrNoRows (SELECT foo10.Bar FROM foo10 WHERE foo10.Id = 42); + return <xml><body> + Reading 1 and 2. + {case res of + None => <xml></xml> + | Some row => <xml>{[row.Foo01.Bar]}</xml>} + {case bla of + None => <xml></xml> + | Some row => <xml>{[row.Foo10.Bar]}</xml>} + </body></xml>