From f425194d947691ceeaad9ec73fdc7c2c176ebfe3 Mon Sep 17 00:00:00 2001 From: Ziv Scully Date: Thu, 15 Oct 2015 00:52:04 -0400 Subject: Make SQL caches use more of the pure caching machinery, but it's brittle. --- caching-tests/test.ur | 11 +++++++++++ caching-tests/test.urs | 1 + 2 files changed, 12 insertions(+) (limited to 'caching-tests') diff --git a/caching-tests/test.ur b/caching-tests/test.ur index 578d59b3..00f05768 100644 --- a/caching-tests/test.ur +++ b/caching-tests/test.ur @@ -11,6 +11,17 @@ fun cache id = | Some row => {[row.Tab.Val]}} +fun cache2 id v = + res <- oneOrNoRows (SELECT tab.Val + FROM tab + WHERE tab.Id = {[id]} AND tab.Val = {[v]}); + return + Reading {[id]}. + {case res of + None => Nope, that's not it. + | Some _ => Hooray! You guessed it!} + + fun flush id = dml (UPDATE tab SET Val = Val * (Id + 2) / Val - 3 diff --git a/caching-tests/test.urs b/caching-tests/test.urs index e9e09ac8..fc23c47d 100644 --- a/caching-tests/test.urs +++ b/caching-tests/test.urs @@ -1,3 +1,4 @@ val cache : int -> transaction page +val cache2 : int -> int -> transaction page val flush : int -> transaction page val flush17 : transaction page -- cgit v1.2.3