From fe522e57197133d3a4a09425bf2067418a6f3c7c Mon Sep 17 00:00:00 2001 From: cweiske Date: Sat, 20 Feb 2010 11:06:12 +0000 Subject: [PATCH] first sql optimization: fetch countOthers() for all bookmarks at once instead of each single git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@661 b3834d28-1941-0410-a4f8-b48e95affb8f --- data/templates/bookmarks.tpl.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data/templates/bookmarks.tpl.php b/data/templates/bookmarks.tpl.php index 0050ec8..b1a6eb0 100644 --- a/data/templates/bookmarks.tpl.php +++ b/data/templates/bookmarks.tpl.php @@ -216,7 +216,13 @@ if($currenttag!= '') {
    0 ? ' start="'. ++$start .'"' : ''); ?> id="bookmarks"> - &$row) { + $addresses[$row['bId']] = $row['bAddress']; + } + $otherCounts = $bookmarkservice->countOthers($addresses); + foreach ($bookmarks as $key => &$row) { switch ($row['bStatus']) { case 0: @@ -261,7 +267,7 @@ if($currenttag!= '') { // Udders! if (!isset($hash)) { - $others = $bookmarkservice->countOthers($row['bAddress']); + $others = $otherCounts[$row['bAddress']]; $ostart = ''; $oend = ''; switch ($others) {