diff options
author | 2009-10-25 15:42:09 +0000 | |
---|---|---|
committer | 2009-10-25 15:42:09 +0000 | |
commit | ae8ca8442e93a6e5cb3f1257df0efa3ff1602656 (patch) | |
tree | 6c4f5fc9b332975c96ff5621ce3c1a56911ecc4a /src/SemanticScuttle/Service/TagCache.php | |
parent | 21db3ef6daeaa4d0da05a7e89c30244e9caff0fd (diff) | |
download | scuttle-ae8ca8442e93a6e5cb3f1257df0efa3ff1602656.tar.gz scuttle-ae8ca8442e93a6e5cb3f1257df0efa3ff1602656.zip |
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
Diffstat (limited to 'src/SemanticScuttle/Service/TagCache.php')
-rw-r--r-- | src/SemanticScuttle/Service/TagCache.php | 18 |
1 files changed, 13 insertions, 5 deletions
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."<br>\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; |