You are viewing a plain text version of this content. The canonical link for it is here.
Posted to olio-commits@incubator.apache.org by ak...@apache.org on 2009/01/27 01:20:17 UTC

svn commit: r737959 - /incubator/olio/webapp/php/trunk/public_html/taggedEvents.php

Author: akara
Date: Tue Jan 27 01:20:16 2009
New Revision: 737959

URL: http://svn.apache.org/viewvc?rev=737959&view=rev
Log:
Fix for issue OLIO-47: Avoid select count()... and changed query from subquery to join.

Modified:
    incubator/olio/webapp/php/trunk/public_html/taggedEvents.php

Modified: incubator/olio/webapp/php/trunk/public_html/taggedEvents.php
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/php/trunk/public_html/taggedEvents.php?rev=737959&r1=737958&r2=737959&view=diff
==============================================================================
--- incubator/olio/webapp/php/trunk/public_html/taggedEvents.php (original)
+++ incubator/olio/webapp/php/trunk/public_html/taggedEvents.php Tue Jan 27 01:20:16 2009
@@ -57,10 +57,10 @@
     if(!is_null($_REQUEST['count'])){
         $count=$_REQUEST['count'];
     }else{
-        $query = "select count(socialeventid) as count from SOCIALEVENTTAG_SOCIALEVENT where socialeventtagid=(select socialeventtagid from SOCIALEVENTTAG where tag='$tag')";
+        $query = "select refcount from SOCIALEVENTTAG where tag = '$tag'";
         $result = $connection->query($query);
         $row = $result->getArray();
-        $count = $row['count'];
+        $count = $row['refcount'];
         unset($result);
     }    
     $numPages  = ceil($count / 10);;
@@ -73,7 +73,13 @@
 }
 
 ob_start();
-$query = "select socialeventid from SOCIALEVENTTAG_SOCIALEVENT where socialeventtagid=(select socialeventtagid from SOCIALEVENTTAG where tag='$tag') limit $offset,10";
+// $query = "select socialeventid from SOCIALEVENTTAG_SOCIALEVENT where socialeventtagid=(select socialeventtagid from SOCIALEVENTTAG where tag='$tag') limit $offset,10";
+// Try out this query instead.
+$query = "select ss.socialeventid ".
+         "from SOCIALEVENTTAG s join SOCIALEVENTTAG_SOCIALEVENT ss ".
+         "on s.socialeventtagid = ss.socialeventtagid ".
+         "where s.tag = '$tag' limit $offset, 10";
+
 $result = $connection->query($query);
 $found = false;
 while ($result->next()) {