commit 1c91d23e6156027ab4a6b719e6a99333d84e773a parent c150020c5c3903b21cae3cd2e0865f428dba8e28 Author: Tomas Hlavaty <tom@logand.com> Date: Sat, 13 Aug 2011 22:49:12 +0200 add with-psequences to toxi tag example Diffstat:
M | test.lisp | | | 49 | +++++++++++++++++++++++++------------------------ |
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/test.lisp b/test.lisp @@ -472,27 +472,28 @@ delete => clear affected instances from cache (2sql-backend:with-postgresql-connection ("pokus" "tomas" "test123" "localhost") (2sql-orm:with-pinstance-collector-cache () - (2sql-orm::with-pclasses (tag bookmark tagmap) - (let* ((t1 (make-tag "bookmark")) - (t2 (make-tag "webservice")) - (t3 (make-tag "semweb")) - (t4 (make-tag "lisp")) - (t5 (make-tag "sql")) - (b1 (make-bookmark "b1")) - (b2 (make-bookmark "b2"))) - (make-tagmap b1 t1) - (make-tagmap b1 t2) - (make-tagmap b1 t3) - (make-tagmap b1 t4) - (make-tagmap b2 t1) - (make-tagmap b2 t2) - (flet ((look-up (q) - (2sql-orm:query () ;; TODO cache compiled queries - `(q:select ((2sql-orm:instance bookmark x)) - (q:from (q:as ,(build-sql-query q) x)))))) - ;; Query for “bookmark+webservice+semweb” - (look-up '(and "bookmark" "webservice" "semweb")) - ;; Query for “bookmark|webservice|semweb” - (look-up '(or "bookmark" "webservice" "semweb")) - ;; Query for “bookmark+webservice-semweb” - (look-up '(not (and "bookmark" "webservice") "semweb"))))))) + (2sql-orm::with-psequences (oid-seq) + (2sql-orm::with-pclasses (tag bookmark tagmap) + (let ((t1 (make-tag "bookmark")) + (t2 (make-tag "webservice")) + (t3 (make-tag "semweb")) + (t4 (make-tag "lisp")) + (t5 (make-tag "sql")) + (b1 (make-bookmark "b1")) + (b2 (make-bookmark "b2"))) + (make-tagmap b1 t1) + (make-tagmap b1 t2) + (make-tagmap b1 t3) + (make-tagmap b1 t4) + (make-tagmap b2 t1) + (make-tagmap b2 t2) + (flet ((look-up (q) + (2sql-orm:query () ;; TODO cache compiled queries + `(q:select ((2sql-orm:instance bookmark x)) + (q:from (q:as ,(build-sql-query q) x)))))) + ;; Query for “bookmark+webservice+semweb” + (look-up '(and "bookmark" "webservice" "semweb")) + ;; Query for “bookmark|webservice|semweb” + (look-up '(or "bookmark" "webservice" "semweb")) + ;; Query for “bookmark+webservice-semweb” + (look-up '(not (and "bookmark" "webservice") "semweb"))))))))