[open-ils-commits] r16793 - trunk/Open-ILS/src/sql/Pg (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jun 23 15:14:44 EDT 2010
Author: miker
Date: 2010-06-23 15:14:39 -0400 (Wed, 23 Jun 2010)
New Revision: 16793
Modified:
trunk/Open-ILS/src/sql/Pg/pgmemcache-ou_tree_traversal_cache.sql
Log:
a bit more protection for non-cached values; beware the null depth in the two-param version of actor.org_unit_descendants!
Modified: trunk/Open-ILS/src/sql/Pg/pgmemcache-ou_tree_traversal_cache.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/pgmemcache-ou_tree_traversal_cache.sql 2010-06-23 18:19:00 UTC (rev 16792)
+++ trunk/Open-ILS/src/sql/Pg/pgmemcache-ou_tree_traversal_cache.sql 2010-06-23 19:14:39 UTC (rev 16793)
@@ -20,7 +20,14 @@
CREATE OR REPLACE FUNCTION actor.org_unit_descendants ( INT, INT ) RETURNS SETOF actor.org_unit AS $$
- SELECT * FROM actor.org_unit_descendants( (actor.org_unit_ancestor_at_depth($1,$2)).id );
+ SELECT *
+ FROM actor.org_unit_descendants(
+ CASE WHEN $2 IS NOT NULL THEN
+ (actor.org_unit_ancestor_at_depth($1,$2)).id
+ ELSE
+ $1
+ END
+ );
$$ LANGUAGE SQL STABLE;
CREATE OR REPLACE FUNCTION actor.noncached_org_unit_descendants ( org INT ) RETURNS SETOF actor.org_unit AS $$
@@ -54,7 +61,7 @@
-- RAISE NOTICE 'Getting perm from cache';
EXECUTE $$SELECT memcache_get('oils_orgcache_$$ || org || $$') AS x;$$ INTO cached_value;
- IF cached_value.x IS NOT NULL THEN
+ IF cached_value.x IS NOT NULL AND cached_value.x <> '' THEN
FOR curr_org IN
SELECT *
FROM actor.org_unit
More information about the open-ils-commits
mailing list