[pLog-svn] r3319 - plog/trunk/class/dao

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Tue May 2 10:38:30 GMT 2006


Author: jondaley
Date: 2006-05-02 10:38:30 +0000 (Tue, 02 May 2006)
New Revision: 3319

Modified:
   plog/trunk/class/dao/articlecategories.class.php
   plog/trunk/class/dao/articlenotifications.class.php
   plog/trunk/class/dao/articles.class.php
   plog/trunk/class/dao/bayesianfilterinfos.class.php
   plog/trunk/class/dao/bayesiantokens.class.php
   plog/trunk/class/dao/blogs.class.php
   plog/trunk/class/dao/commentscommon.class.php
   plog/trunk/class/dao/model.class.php
   plog/trunk/class/dao/referers.class.php
   plog/trunk/class/dao/searchengine.class.php
   plog/trunk/class/dao/sitestatistics.class.php
Log:
close result object when we are done with it.  Only for SELECT, SHOW, DESCRIBE or EXPLAIN statements.

Modified: plog/trunk/class/dao/articlecategories.class.php
===================================================================
--- plog/trunk/class/dao/articlecategories.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/articlecategories.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -318,6 +318,7 @@
 					while( $row = $result->FetchRow()) {
 						$categoryLinks[] = $row["category_id"];
 					}
+                    $result->Close();			
 					$this->_cache->setData( $articleId, CACHE_ARTICLE_CATEGORIES_LINK, $categoryLinks );
 				}
 				else

Modified: plog/trunk/class/dao/articlenotifications.class.php
===================================================================
--- plog/trunk/class/dao/articlenotifications.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/articlenotifications.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -48,6 +48,7 @@
             while( $row = $result->FetchRow()) {
             	array_push( $notifications, $this->mapRow( $row ));
             }
+            $result->Close();			
 
             return $notifications;
         }
@@ -249,10 +250,13 @@
             if( !$result )
             	return false;
 
-            if( $result->RecordCount() == 0 )
+            if( $result->RecordCount() == 0 ){
+                $result->Close();			
             	return false;
+            }
 
             $notification = $this->mapRow( $result->fetchRow());
+            $result->Close();			
 
             return $notification;
          }

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/articles.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -126,7 +126,8 @@
 
             $row = $result->FetchRow( $result );
             $article = $this->mapRow( $row, $includeHiddenFields );
-
+            $result->Close();
+            
             return $article;        
         }
 
@@ -219,6 +220,7 @@
 			else {
 				$number = $result->RowCount();
 			}
+            $result->Close();
             return( $number );                 
 		}
 		
@@ -313,7 +315,7 @@
 			while( $row = $result->FetchRow()) {
 				$ids[] = $row['article_id'];
 			}
-			
+			$result->Close();
 			if ( !empty( $ids ) )
 				$searchCondition = 'a.id IN ('.implode( ', ', $ids ).')';
 			else
@@ -465,8 +467,10 @@
             if( !$result )
                 return Array();
 				
-			if( $result->RowCount() == 0 )
+			if( $result->RowCount() == 0 ){
+                $result->Close();
 				return Array();
+            }
             
 			$articles = Array();
             while( $row = $result->FetchRow()) {
@@ -530,6 +534,7 @@
                 while( $row = $result->FetchRow()) {
                     $archives[$row["year"]][$row["month"]] = $row["count"];
                 }
+                $result->Close();
                 $this->_cache->setData( $blogId, CACHE_ARTICLESPERMONTH, $archives );
             }
 
@@ -558,6 +563,7 @@
             	$month = $row["month"];
             	$archives[$year][$month] = 1;
             }
+            $result->Close();
 
             return $archives;
         }
@@ -619,6 +625,7 @@
                 $day = substr($date,6,2);
                 $postsPerDay[intval($day)] = 1;
             }           
+            $result->Close();
 
             return $postsPerDay;
         }
@@ -652,7 +659,7 @@
                 $query = Db::buildInsertQuery( ARTICLE_CATEGORIES_RELATIONSHIP_TABLENAME,
                                                $keyValuePairs );
                 $this->Execute( $query );
-                
+
                	$category = $articleCategories->getCategory( $categoryId );                
                 if( $article->getStatus() == POST_STATUS_PUBLISHED ) {
                 	$category->setNumPublishedArticles( $category->getNumPublishedArticles() +1 );
@@ -865,6 +872,7 @@
                     return false;
                     
                 $text = $result->FetchRow();
+                $result->Close();
 
                 $this->_cache->setData( $articleId, CACHE_ARTICLETEXT, $text );
             }
@@ -1189,7 +1197,7 @@
             while( $row = $result->FetchRow()) {
                 $this->deleteArticle( $row["id"], $row["user_id"], $row["blog_id"], true );
             }
-
+            $result->Close();
             return true;
         }
 

Modified: plog/trunk/class/dao/bayesianfilterinfos.class.php
===================================================================
--- plog/trunk/class/dao/bayesianfilterinfos.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/bayesianfilterinfos.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -40,6 +40,7 @@
             	return false;
 
             $row = $result->FetchRow();
+            $result->Close();			
             return $this->_mapRowToObject($row);
         }
 

Modified: plog/trunk/class/dao/bayesiantokens.class.php
===================================================================
--- plog/trunk/class/dao/bayesiantokens.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/bayesiantokens.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -112,7 +112,8 @@
 			if ($token === false)
 			{
 	            $row = $result->FetchRow();
-	            
+                $result->Close();			
+
 	            if(!$row)
 	            	return false;
 	            	
@@ -124,10 +125,12 @@
 				{
 					if ($row["token"] == $token)
 					{
+                        $result->Close();			
 						return $this->_mapRowToObject($row);
 					}					
 				}
-			
+                $result->Close();			
+
 				return false;
 			}
         }

Modified: plog/trunk/class/dao/blogs.class.php
===================================================================
--- plog/trunk/class/dao/blogs.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/blogs.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -215,6 +215,7 @@
 				$this->_cache->setData( $blog->getMangledBlogName(), CACHE_BLOGIDBYNAME, $blog );				
 				$this->_cache->setData( $blog->getCustomDomain(), CACHE_BLOGIDBYDOMAIN, $blog );				
             }
+            $result->Close();			
 
             return $blogs;									
         }    
@@ -236,6 +237,8 @@
             while( $row = $result->FetchRow()) {
                 $blogIds[] = $row['id'];
             }
+            $result->Close();			
+
             return $blogIds;
         }
 

Modified: plog/trunk/class/dao/commentscommon.class.php
===================================================================
--- plog/trunk/class/dao/commentscommon.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/commentscommon.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -429,15 +429,18 @@
 			if( !$result )
 				return false;
 				
-			if( $result->RowCount() == 0 )
+			if( $result->RowCount() == 0 ){
+                $result->Close();			
 				return Array();
+            }
 				
 			$comments = Array();
 			$articles = new Articles();
 			while( $row = $result->FetchRow()) {
 				$comments[] = $this->mapRow( $row );
 			}
-			
+            $result->Close();			
+
 			/*if( $page > -1 && $amount > -1 )
 				$comments = array_slice( $comments,	($page-1) * $amount, $amount );*/
         				 

Modified: plog/trunk/class/dao/model.class.php
===================================================================
--- plog/trunk/class/dao/model.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/model.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -182,11 +182,14 @@
 	        	if( !$result )
 	        		return false;
 	        	
-	        	if( $result->RowCount() == 0 )
+	        	if( $result->RowCount() == 0 ){
+                    $result->Close();
 	        		return false;
+                }
 	        		
 	        	$row = $result->FetchRow();
-	        	
+                $result->Close();
+
 	        	$dbObject = $this->mapRow( $row );
 	        	
 	        	$this->_cache->setData( $value, $cacheId, $dbObject );
@@ -323,8 +326,10 @@
 	        	if( !$result )
 	        		return false;
 	        	
-	        	if( $result->RowCount() == 0 )
+	        	if( $result->RowCount() == 0 ){
+                    $result->Close();
 	        		return false;
+                }
 	        		
 	        	$dbObjects = Array();
 	        	while( $row = $result->FetchRow()) {        	
@@ -336,7 +341,8 @@
 	        			}
 	        		}
 		        }
-	        	
+                $result->Close();
+
 				// do not cache data if using search terms!
 				if( $searchTerms == "" ) 
 					$this->_cache->setData( $value, $cacheId, $dbObjects );
@@ -487,10 +493,10 @@
             
             // if no error, get the result
             $row = $result->FetchRow();
+            $result->Close();			
+
             $total = $row["total"];
             if( $total == "" ) $total = 0;
-			
-            $result->Close();			
 
             return $total;
         }

Modified: plog/trunk/class/dao/referers.class.php
===================================================================
--- plog/trunk/class/dao/referers.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/referers.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -142,6 +142,7 @@
             $referers = Array();
             while( $row = $result->FetchRow())
             	array_push( $referers, $this->_fillRefererInformation( $row ));
+            $result->Close();
 
             return $referers;
 		
@@ -184,6 +185,7 @@
 				
 			$row = $result->FetchRow();
 			$referrer = $this->_fillRefererInformation( $row );
+            $result->Close();
 
 			return $referrer;
 		}

Modified: plog/trunk/class/dao/searchengine.class.php
===================================================================
--- plog/trunk/class/dao/searchengine.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/searchengine.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -207,7 +207,8 @@
 			while( $row = $result->FetchRow()) {				
 				$results[] = new SearchResult( $articles->mapRow( $row ), SEARCH_RESULT_CUSTOM_FIELD, $searchTerms );
 			}
-			
+            $result->Close();
+
 			return( $results );
         }
 

Modified: plog/trunk/class/dao/sitestatistics.class.php
===================================================================
--- plog/trunk/class/dao/sitestatistics.class.php	2006-05-02 10:16:00 UTC (rev 3318)
+++ plog/trunk/class/dao/sitestatistics.class.php	2006-05-02 10:38:30 UTC (rev 3319)
@@ -20,6 +20,7 @@
             $result = $this->Execute( $query );
 
             $row = $result->FetchRow();
+            $result->Close();
 
             return $row["total"];
         }



More information about the pLog-svn mailing list