From ae8ca8442e93a6e5cb3f1257df0efa3ff1602656 Mon Sep 17 00:00:00 2001 From: cweiske Date: Sun, 25 Oct 2009 15:42:09 +0000 Subject: Fix *all* unfreed results in unit tests - this was a hard task, but worth it git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@414 b3834d28-1941-0410-a4f8-b48e95affb8f --- src/SemanticScuttle/Service/TagCache.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/SemanticScuttle/Service/TagCache.php') diff --git a/src/SemanticScuttle/Service/TagCache.php b/src/SemanticScuttle/Service/TagCache.php index 9e8b298..7908ae3 100644 --- a/src/SemanticScuttle/Service/TagCache.php +++ b/src/SemanticScuttle/Service/TagCache.php @@ -121,8 +121,10 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService //echo($query."
\n"); - return $this->db->sql_numrows($this->db->sql_query($query)) > 0; - + $dbres = $this->db->sql_query($query); + $rows = $this->db->sql_numrows($dbres); + $this->db->sql_freeresult($dbres); + return $rows > 0; } /* @@ -221,7 +223,10 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService $query.= " AND relationType = '='"; $query.= " AND uId = '".$uId."'"; - return $this->db->sql_numrows($this->db->sql_query($query)) > 0; + $dbres = $this->db->sql_query($query); + $rows = $this->db->sql_numrows($dbres); + $this->db->sql_freeresult($dbres); + return $rows > 0; } function _isSynonymValue($tag2, $uId) { @@ -233,7 +238,10 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService $query.= " AND relationType = '='"; $query.= " AND uId = '".$uId."'"; - return $this->db->sql_numrows($this->db->sql_query($query)) > 0; + $dbres = $this->db->sql_query($query); + $rows = $this->db->sql_numrows($dbres); + $this->db->sql_freeresult($dbres); + return $rows > 0; } function getSynonyms($tag1, $uId) { @@ -252,7 +260,7 @@ class SemanticScuttle_Service_TagCache extends SemanticScuttle_DbService $tagservice =SemanticScuttle_Service_Factory::get('Tag'); $tag2 = $tagservice->normalize($tag2); - if($this->_isSynonymKey($tag2)) return $tag2; + if($this->_isSynonymKey($tag2, $uId)) return $tag2; if($tag2 == '') return false; -- cgit v1.2.3-54-g00ecf