[pLog-svn] r2164 - plog/branches/plog-1.0.2/class/dao
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Sun Jun 5 10:51:14 GMT 2005
Author: oscar
Date: 2005-06-05 10:51:13 +0000 (Sun, 05 Jun 2005)
New Revision: 2164
Modified:
plog/branches/plog-1.0.2/class/dao/articlecategories.class.php
plog/branches/plog-1.0.2/class/dao/articlecomments.class.php
plog/branches/plog-1.0.2/class/dao/articles.class.php
plog/branches/plog-1.0.2/class/dao/blogs.class.php
plog/branches/plog-1.0.2/class/dao/model.class.php
Log:
Added a $result->Close() so that ADOdb/mysql can free the memory used by the result sets and query results hopefully saving a bit of memory (don't know how much though)
Modified: plog/branches/plog-1.0.2/class/dao/articlecategories.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/articlecategories.class.php 2005-06-04 16:47:31 UTC (rev 2163)
+++ plog/branches/plog-1.0.2/class/dao/articlecategories.class.php 2005-06-05 10:51:13 UTC (rev 2164)
@@ -98,6 +98,8 @@
// ...and store the result
$this->cache[$categoryId] = $category;
+
+ $result->Close();
return $category;
}
@@ -126,6 +128,8 @@
$category = $this->_fillCategoryInformation( $row );
$categories[$category->getId()] = $category;
}
+
+ $result->Close();
return $categories;
}
@@ -256,6 +260,8 @@
// we can cache this information for later...
$this->cache[$category->getId()] = $category;
}
+
+ $result->Close();
return $categories;
}
@@ -338,6 +344,7 @@
$row = $result->FetchRow();
$total = $row["count"];
if( $total == "" ) $total = 0;
+ else $result->Close();
return( $total );
}
@@ -450,6 +457,8 @@
$category = $this->_fillCategoryInformation( $row );
array_push( $categories, $category );
}
+
+ $result->Close();
return $categories;
}
@@ -493,6 +502,7 @@
$categories[$lastArticleId][]=$category;
}
+ $result->Close();
return $categories;
}
Modified: plog/branches/plog-1.0.2/class/dao/articlecomments.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/articlecomments.class.php 2005-06-04 16:47:31 UTC (rev 2163)
+++ plog/branches/plog-1.0.2/class/dao/articlecomments.class.php 2005-06-05 10:51:13 UTC (rev 2164)
@@ -132,6 +132,8 @@
$comments[] = $comment;
}
+
+ $result->Close();
return $comments;
}
@@ -198,6 +200,8 @@
// save the comment in the array
$comments[$lastArticleId][]=$comment;
}
+
+ $result->Close();
return $comments;
}
@@ -242,6 +246,8 @@
$row = $result->FetchRow();
$comment = $this->_fillCommentInformation( $row );
+
+ $result->Close();
return $comment;
}
@@ -269,6 +275,8 @@
return false;
$row = $result->FetchRow();
+
+ $result->Close();
if( $row["total"] >= 1 )
return true;
@@ -320,6 +328,8 @@
$tmpRow = $result->FetchRow();
$blogSettings = Blogs::getBlogSettingsFromField( $tmpRow["settings"] );
$this->_blogSettings[$articleId] = $blogSettings;
+
+ $result->Close();
}
else {
$blogSettings = $this->_blogSettings[$articleId];
@@ -457,6 +467,8 @@
$row = $result->FetchRow();
+ $result->Close();
+
return $this->_fillCommentInformation( $row );
}
@@ -500,8 +512,10 @@
// and store everything in the array
$comments[] = $comment;
}
+
+ $result->Close();
return $comments;
}
}
-?>
+?>
\ No newline at end of file
Modified: plog/branches/plog-1.0.2/class/dao/articles.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/articles.class.php 2005-06-04 16:47:31 UTC (rev 2163)
+++ plog/branches/plog-1.0.2/class/dao/articles.class.php 2005-06-05 10:51:13 UTC (rev 2164)
@@ -78,6 +78,8 @@
$row = $result->FetchRow( $result );
$article = $this->_fillArticleInformation( $row );
+
+ $result->Close();
return $article;
}
@@ -112,7 +114,7 @@
if( $categoryId != -1 )
$query .= " AND c.id = ".Db::qstr($categoryId)." AND c.id = l.category_id AND a.id = l.article_id";
if( $status != POST_STATUS_ALL )
- $query .= " AND a.status = $status;";
+ $query .= " AND a.status = $status;";
return $this->_getBlogArticleFromQuery( $query, $includeHiddenFields );
}
@@ -168,6 +170,8 @@
$row = $result->FetchRow( $result );
$article = $this->_fillArticleInformation( $row, $includeHiddenFields );
+
+ $result->Close();
return $article;
}
@@ -300,7 +304,7 @@
/**
* @see getBlogArticles
*/
- function getNumBlogArticles( $blogid, $date = -1, $amount = -1, $categoryId = 0, $status = 0, $userId = 0, $maxDate = 0, $searchTerms = "" )
+ function getNumBlogArticles( $blogid, $date = -1, $amount = -1, $categoryId = -1, $status = 0, $userId = 0, $maxDate = 0, $searchTerms = "" )
{
$postStatus = $status;
$prefix = $this->getPrefix();
@@ -317,13 +321,17 @@
if( $categoryId != -1 )
$query .= " GROUP BY a.id";
-
+
$result = $this->_db->Execute( $query );
if( !$result )
return 0;
- return $result->RowCount();
+ $number = $result->RowCount();
+
+ $result->Close();
+
+ return( $number );
}
/**
@@ -430,6 +438,8 @@
$this->cache[$lastArticleId] = $article;
}
+ $result->Close();
+
return $fullarticles;
}
@@ -445,6 +455,7 @@
$result = $this->Execute($query);
if($row = $result->FetchRow()){
+ $result->Close();
if($row["id"])
return $row["id"];
}
@@ -479,6 +490,8 @@
$postTexts[$lastArticleId]=$row;
}
+ $result->Close();
+
return( $postTexts );
}
@@ -498,6 +511,9 @@
$article = $this->_fillArticleInformation( $row );
$articles[] = $article;
}
+
+ $result->Close();
+
return $articles;
}
@@ -527,6 +543,8 @@
while( $row = $result->FetchRow()) {
$archives[$row["year"]][$row["month"]] = $row["count"];
}
+
+ $result->Close();
return $archives;
}
@@ -554,6 +572,8 @@
while( $row = $result->FetchRow()) {
$archives[$row["year"]][$row["month"]] = $row["count"];
}
+
+ $result->Close();
return $archives;
}
@@ -601,6 +621,8 @@
while( $row = $result->FetchRow()) {
$postsPerDay[$row["day"]] = $row["count"];
}
+
+ $result->Close();
return $postsPerDay;
}
@@ -734,7 +756,11 @@
if( !$result )
return false;
- return( $result->FetchRow());
+ $row = $result->FetchRow();
+
+ $result->Close();
+
+ return( $row );
}
/**
@@ -996,6 +1022,8 @@
while( $row = $result->FetchRow()) {
$posts[] = $this->_fillArticleInformation( $row );
}
+
+ $result->Close();
return $posts;
}
@@ -1034,6 +1062,8 @@
while( $row = $result->FetchRow()) {
$this->deleteArticle( $row["id"], $row["user_id"], $row["blog_id"], true );
}
+
+ $result->Close();
return true;
}
@@ -1066,6 +1096,8 @@
while( $row = $result->FetchRow()) {
$categories[] = $row['category_id'];
}
+
+ $result->Close();
return $categories;
}
@@ -1225,4 +1257,4 @@
return true;
}
}
-?>
+?>
\ No newline at end of file
Modified: plog/branches/plog-1.0.2/class/dao/blogs.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/blogs.class.php 2005-06-04 16:47:31 UTC (rev 2163)
+++ plog/branches/plog-1.0.2/class/dao/blogs.class.php 2005-06-05 10:51:13 UTC (rev 2164)
@@ -67,6 +67,8 @@
$blogInfo = $this->_fillBlogInformation( $row, $extendedInfo );
$blogSettings = $this->getBlogSettingsFromField( $row["settings"] );
$blogInfo->setSettings( $blogSettings );
+
+ $result->Close();
return $blogInfo;
}
@@ -177,7 +179,11 @@
if (!isset($row["total"]))
return false;
- return intval($row["total"]);
+ $posts = intval($row["total"]);
+
+ $result->Close();
+
+ return( $posts );
}
/**
@@ -199,7 +205,11 @@
if (!isset($row["total"]))
return false;
- return intval($row["total"]);
+ $comments = intval($row["total"]);
+
+ $result->Close();
+
+ return( $comments );
}
/**
@@ -261,6 +271,8 @@
$result = $this->Execute( $query );
$row = $result->FetchRow();
+
+ $result->Close();
return $this->getBlogSettingsFromField( $row["settings"] );
}
@@ -413,6 +425,8 @@
$blog = $this->_fillBlogInformation( $row, true );
$blogs[$blog->getId()] = $blog;
}
+
+ $result->Close();
return $blogs;
}
@@ -434,6 +448,9 @@
while( $row = $result->FetchRow()) {
$blogIds[] = $row['id'];
}
+
+ $result->Close();
+
return $blogIds;
}
@@ -508,4 +525,4 @@
return true;
}
}
-?>
+?>
\ No newline at end of file
Modified: plog/branches/plog-1.0.2/class/dao/model.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/dao/model.class.php 2005-06-04 16:47:31 UTC (rev 2163)
+++ plog/branches/plog-1.0.2/class/dao/model.class.php 2005-06-05 10:51:13 UTC (rev 2164)
@@ -175,8 +175,10 @@
$row = $result->FetchRow();
$total = $row["total"];
if( $total == "" ) $total = 0;
+
+ $result->Close();
return $total;
}
}
-?>
+?>
\ No newline at end of file
More information about the pLog-svn
mailing list