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/Tag2Tag.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/SemanticScuttle/Service/Tag2Tag.php') diff --git a/src/SemanticScuttle/Service/Tag2Tag.php b/src/SemanticScuttle/Service/Tag2Tag.php index cc8abb8..dcbcf2e 100644 --- a/src/SemanticScuttle/Service/Tag2Tag.php +++ b/src/SemanticScuttle/Service/Tag2Tag.php @@ -39,7 +39,7 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService $values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> $relationType, 'uId'=> $uId); $query = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values); //die($query); - if (!($dbresult =& $this->db->sql_query($query))) { + if (!($dbresult = $this->db->sql_query($query))) { $this->db->sql_transaction('rollback'); message_die(GENERAL_ERROR, 'Could not attach tag to tag', '', __LINE__, __FILE__, $query, $this->db); return false; @@ -280,7 +280,10 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService //echo($query."
\n"); - return $this->db->sql_numrows($this->db->sql_query($query)) > 0; + $dbres = $this->db->sql_query($query); + $hasTags = $this->db->sql_numrows($dbres) > 0; + $this->db->sql_freeresult($dbres); + return $hasTags; } function getLinks($uId) { @@ -290,7 +293,10 @@ class SemanticScuttle_Service_Tag2Tag extends SemanticScuttle_DbService $query.= " AND uId = '".$uId."'"; } - return $this->db->sql_fetchrowset($this->db->sql_query($query)); + $dbres = $this->db->sql_query($query); + $rowset = $this->db->sql_fetchrowset($dbres); + $this->db->sql_freeresult($dbres); + return $rowset; } function removeLinkedTags($tag1, $tag2, $relationType, $uId) { -- cgit v1.2.3