[pLog-svn] r3370 - in plog/trunk/class: dao dao/userdata gallery/dao

mark at devel.lifetype.net mark at devel.lifetype.net
Tue May 9 02:46:52 GMT 2006


Author: mark
Date: 2006-05-09 02:46:51 +0000 (Tue, 09 May 2006)
New Revision: 3370

Modified:
   plog/trunk/class/dao/articles.class.php
   plog/trunk/class/dao/sitestatistics.class.php
   plog/trunk/class/dao/userdata/phpbb2userdataprovider.class.php
   plog/trunk/class/gallery/dao/galleryresources.class.php
Log:
According to Christoph's suggestion, I just change the sql to count the primary key only, instead of count whole row.

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2006-05-09 02:45:55 UTC (rev 3369)
+++ plog/trunk/class/dao/articles.class.php	2006-05-09 02:46:51 UTC (rev 3370)
@@ -204,7 +204,7 @@
             $postStatus = $status;
 		    $prefix = $this->getPrefix();
             $where = $this->buildWhere( $blogId, $date, -1, $categoryId, $status, $userId, $maxDate, $searchTerms );
-            $query = "SELECT COUNT(*) AS total FROM {$prefix}articles a, {$prefix}articles_categories c, {$prefix}article_categories_link l WHERE $where ";
+            $query = "SELECT COUNT(id) AS total FROM {$prefix}articles a, {$prefix}articles_categories c, {$prefix}article_categories_link l WHERE $where ";
 
             $result = $this->_db->Execute( $query );
             
@@ -511,7 +511,7 @@
 
 				$prefix = $this->getPrefix();
                 if( $blogSettings->getValue("show_future_posts_in_calendar") )
-                    $numPostsPerMonthQuery = "SELECT COUNT(*) AS 'count',
+                    $numPostsPerMonthQuery = "SELECT COUNT(id) AS 'count',
                                               YEAR(date) AS 'year',
                                               MONTH(date) AS 'month'
                                               FROM {$prefix}articles 
@@ -519,7 +519,7 @@
                                               GROUP BY YEAR(date),MONTH(date) 
                                               ORDER BY YEAR(date) DESC,MONTH(date) DESC;";
                 else
-                    $numPostsPerMonthQuery = "SELECT COUNT(*) AS 'count',
+                    $numPostsPerMonthQuery = "SELECT COUNT(id) AS 'count',
                                                 YEAR(date) AS 'year',
                                                 MONTH(date) AS 'month'
                                               FROM {$prefix}articles

Modified: plog/trunk/class/dao/sitestatistics.class.php
===================================================================
--- plog/trunk/class/dao/sitestatistics.class.php	2006-05-09 02:45:55 UTC (rev 3369)
+++ plog/trunk/class/dao/sitestatistics.class.php	2006-05-09 02:46:51 UTC (rev 3370)
@@ -27,21 +27,21 @@
 
         function getNumberOfBlogs()
         {
-        	$query = "SELECT COUNT(*) AS total FROM ".$this->getPrefix()."blogs";
+        	$query = "SELECT COUNT(id) AS total FROM ".$this->getPrefix()."blogs";
 
             return $this->getTotalFromQuery( $query );
         }
 
         function getNumberOfPosts()
         {
-        	$query = "SELECT COUNT(*) AS total FROM ".$this->getPrefix()."articles WHERE status = 1";
+        	$query = "SELECT COUNT(id) AS total FROM ".$this->getPrefix()."articles WHERE status = 1";
 
             return $this->getTotalFromQuery( $query );
         }
 
         function getNumberOfUsers()
         {
-        	$query = "SELECT COUNT(*) AS total FROM ".$this->getPrefix()."users";
+        	$query = "SELECT COUNT(id) AS total FROM ".$this->getPrefix()."users";
 
             return $this->getTotalFromQuery( $query );
         }
@@ -52,7 +52,7 @@
 
         	$today = new Timestamp();
             $todayTimestamp = $today->getYear().$today->getMonth().$today->getDay();
-        	$query = "SELECT COUNT(*) AS total FROM ".$this->getPrefix()."articles".
+        	$query = "SELECT COUNT(id) AS total FROM ".$this->getPrefix()."articles".
                      " WHERE date LIKE '$todayTimestamp%' AND status = 1";
 
             return $this->getTotalFromQuery( $query );
@@ -64,7 +64,7 @@
 
         	$today = new Timestamp();
             $monthTimestamp = $today->getYear().$today->getMonth();
-        	$query = "SELECT COUNT(*) AS total FROM ".$this->getPrefix()."articles".
+        	$query = "SELECT COUNT(id) AS total FROM ".$this->getPrefix()."articles".
                      " WHERE date LIKE '$monthTimestamp%' AND status = 1";
 
             return $this->getTotalFromQuery( $query );

Modified: plog/trunk/class/dao/userdata/phpbb2userdataprovider.class.php
===================================================================
--- plog/trunk/class/dao/userdata/phpbb2userdataprovider.class.php	2006-05-09 02:45:55 UTC (rev 3369)
+++ plog/trunk/class/dao/userdata/phpbb2userdataprovider.class.php	2006-05-09 02:46:51 UTC (rev 3370)
@@ -404,7 +404,7 @@
 	        // :TODO:
 	        // add the status check here!
 	        //
-	        $query = "SELECT COUNT(*) AS total FROM ".$this->_phpbbprefix."users";
+	        $query = "SELECT COUNT(id) AS total FROM ".$this->_phpbbprefix."users";
 	        
 	        $result = $this->_dbc->Execute( $query );
 	        

Modified: plog/trunk/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresources.class.php	2006-05-09 02:45:55 UTC (rev 3369)
+++ plog/trunk/class/gallery/dao/galleryresources.class.php	2006-05-09 02:46:51 UTC (rev 3370)
@@ -778,7 +778,7 @@
 		 */
         function isDuplicatedFilename( $fileName )
         {
-        	$query = "SELECT COUNT(*) AS total FROM ".$this->getPrefix()."gallery_resources
+        	$query = "SELECT COUNT(id) AS total FROM ".$this->getPrefix()."gallery_resources
                       WHERE file_name = '$fileName'";
 
             $result = $this->Execute( $query );



More information about the pLog-svn mailing list