diff options
Diffstat (limited to 'caching-tests')
-rw-r--r-- | caching-tests/test.db | bin | 0 -> 3072 bytes | |||
-rw-r--r-- | caching-tests/test.sql | 11 | ||||
-rw-r--r-- | caching-tests/test.ur | 52 | ||||
-rw-r--r-- | caching-tests/test.urp | 7 | ||||
-rw-r--r-- | caching-tests/test.urs | 6 |
5 files changed, 76 insertions, 0 deletions
diff --git a/caching-tests/test.db b/caching-tests/test.db Binary files differnew file mode 100644 index 00000000..190d2868 --- /dev/null +++ b/caching-tests/test.db diff --git a/caching-tests/test.sql b/caching-tests/test.sql new file mode 100644 index 00000000..862245b7 --- /dev/null +++ b/caching-tests/test.sql @@ -0,0 +1,11 @@ +CREATE TABLE uw_Test_foo01(uw_id integer NOT NULL, uw_bar text NOT NULL, + PRIMARY KEY (uw_id) + + ); + + CREATE TABLE uw_Test_foo10(uw_id integer NOT NULL, uw_bar text NOT NULL, + PRIMARY KEY (uw_id) + + ); + +
\ No newline at end of file diff --git a/caching-tests/test.ur b/caching-tests/test.ur new file mode 100644 index 00000000..a99a387b --- /dev/null +++ b/caching-tests/test.ur @@ -0,0 +1,52 @@ +table foo01 : {Id : int, Bar : string} PRIMARY KEY Id +table foo10 : {Id : int, Bar : string} PRIMARY KEY Id + +fun flush01 () : transaction page = + dml (UPDATE foo01 SET Bar = "baz01" WHERE Id = 42); + 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 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.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.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.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> diff --git a/caching-tests/test.urp b/caching-tests/test.urp new file mode 100644 index 00000000..123f58e5 --- /dev/null +++ b/caching-tests/test.urp @@ -0,0 +1,7 @@ +database test.db +sql test.sql +safeGet Test/flush01 +safeGet Test/flush10 +safeGet Test/flush11 + +test diff --git a/caching-tests/test.urs b/caching-tests/test.urs new file mode 100644 index 00000000..ce7d0350 --- /dev/null +++ b/caching-tests/test.urs @@ -0,0 +1,6 @@ +val cache01 : unit -> transaction page +val cache10 : unit -> transaction page +val cache11 : unit -> transaction page +val flush01 : unit -> transaction page +val flush10 : unit -> transaction page +val flush11 : unit -> transaction page |