From c0e46287e41ac5be4c4832c915c8e2ba78b9a1d5 Mon Sep 17 00:00:00 2001 From: mensonge Date: Tue, 3 Feb 2009 15:32:23 +0000 Subject: Refactoring: free few sql results git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@247 b3834d28-1941-0410-a4f8-b48e95affb8f --- services/bookmarkservice.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'services/bookmarkservice.php') diff --git a/services/bookmarkservice.php b/services/bookmarkservice.php index 4b000b4..1d72bc8 100644 --- a/services/bookmarkservice.php +++ b/services/bookmarkservice.php @@ -32,10 +32,12 @@ class BookmarkService { } if ($row =& $this->db->sql_fetchrow($dbresult)) { - return $row; + $output = $row; } else { - return false; + $output = false; } + $this->db->sql_freeresult($dbresult); + return $output; } function & getBookmark($bid, $include_tags = false) { @@ -52,10 +54,12 @@ class BookmarkService { $b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService'); $row['tags'] = $b2tservice->getTagsForBookmark($bid); } - return $row; + $output = $row; } else { - return false; + $output = false; } + $this->db->sql_freeresult($dbresult); + return $output; } function getBookmarkByAddress($address) { @@ -103,7 +107,9 @@ class BookmarkService { if (!($dbresult = & $this->db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not get vars', '', __LINE__, __FILE__, $sql, $this->db); } - return ($this->db->sql_fetchfield(0, 0) > 0); + $ouput = ($this->db->sql_fetchfield(0, 0) > 0); + $this->db->sql_freeresult($dbresult); + return $output; } // Adds a bookmark to the database. @@ -390,6 +396,7 @@ class BookmarkService { $bookmarks[] = $row; } + $this->db->sql_freeresult($dbresult); $output = array ('bookmarks' => $bookmarks, 'total' => $total); return $output; } @@ -451,7 +458,10 @@ class BookmarkService { if (!($dbresult = & $this->db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not get vars', '', __LINE__, __FILE__, $sql, $this->db); } - return $this->db->sql_fetchfield(0, 0) - 1; + + $output = $this->db->sql_fetchfield(0, 0) - 1; + $this->db->sql_freeresult($dbresult); + return $output; } function normalize($address) { -- cgit v1.2.3