[pLog-svn] r1752 - plog/branches/plog-1.0.1/class/dao
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Tue Apr 5 19:23:18 GMT 2005
Author: oscar
Date: 2005-04-05 19:23:17 +0000 (Tue, 05 Apr 2005)
New Revision: 1752
Modified:
plog/branches/plog-1.0.1/class/dao/articlecomments.class.php
plog/branches/plog-1.0.1/class/dao/articles.class.php
Log:
for each article and comment, it makes no sense to ask mysql to load the normalized_text and normalized_topic fields because we're not going to need them as they are only used by the search engine. This should hopefully save some memory and solve issue 400 (http://bugs.plogworld.net/view.php?id=400)
I am going to apply the same modifications to other tables as well (such as the ones related to resources)
Modified: plog/branches/plog-1.0.1/class/dao/articlecomments.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/dao/articlecomments.class.php 2005-04-05 19:17:36 UTC (rev 1751)
+++ plog/branches/plog-1.0.1/class/dao/articlecomments.class.php 2005-04-05 19:23:17 UTC (rev 1752)
@@ -75,7 +75,11 @@
*/
function getPostComments( $artid, $order = COMMENT_ORDER_NEWEST_FIRST, $status = COMMENT_STATUS_ALL, $page = -1, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
{
- $query = "SELECT * FROM ".$this->getPrefix()."articles_comments WHERE article_id = ".$artid;
+ $query = "SELECT id,article_id,topic,
+ text,date,user_email,user_url,user_name,parent_id,
+ client_ip,send_notification,status,spam_rate,properties
+ FROM ".$this->getPrefix()."articles_comments
+ WHERE article_id = ".$artid;
if( $status != COMMENT_STATUS_ALL )
$query .= " AND status = $status";
@@ -136,7 +140,10 @@
function getPostCommentsByIds( $ids, $order = COMMENT_ORDER_NEWEST_FIRST, $status = COMMENT_STATUS_ALL )
{
- $query = "SELECT * FROM ".$this->getPrefix()."articles_comments WHERE article_id IN (".$ids.")";
+ $query = "SELECT id,article_id,topic,
+ text,date,user_email,user_url,user_name,parent_id,
+ client_ip,send_notification,status,spam_rate,properties
+ FROM ".$this->getPrefix()."articles_comments WHERE article_id IN (".$ids.")";
if( $status != COMMENT_STATUS_ALL )
$query .= " AND status = $status";
@@ -200,16 +207,16 @@
*/
function getNumPostComments( $artId, $status = COMMENT_STATUS_ALL )
{
- // create the table name
- $prefix = $this->getPrefix();
- $table = "{$prefix}articles_comments";
- // and the condition if any...
- $cond = "article_id = '".Db::qstr($artId)."'";
- if( $status != COMMENT_STATUS_ALL )
- $cond .= " AND status = '".Db::qstr($status)."'";
-
- // get the number of items and return it to the caller
- return( $this->getNumItems( $table, $cond ));
+ // create the table name
+ $prefix = $this->getPrefix();
+ $table = "{$prefix}articles_comments";
+ // and the condition if any...
+ $cond = "article_id = '".Db::qstr($artId)."'";
+ if( $status != COMMENT_STATUS_ALL )
+ $cond .= " AND status = '".Db::qstr($status)."'";
+
+ // get the number of items and return it to the caller
+ return( $this->getNumItems( $table, $cond ));
}
@@ -218,7 +225,11 @@
*/
function getPostComment( $artid, $commentid )
{
- $query = "SELECT * FROM ".$this->getPrefix()."articles_comments WHERE id = ".$commentid." AND article_id = ".$artid.";";
+ $query = "SELECT id,article_id,topic,
+ text,date,user_email,user_url,user_name,parent_id,
+ client_ip,send_notification,status,spam_rate,properties
+ FROM ".$this->getPrefix()."articles_comments
+ WHERE id = ".$commentid." AND article_id = '".Db::qstr($artid)."';";
$result = $this->Execute( $query );
@@ -427,7 +438,10 @@
*/
function getComment( $id )
{
- $query = "SELECT * FROM ".$this->getPrefix()."articles_comments
+ $query = "SELECT id,article_id,topic,
+ text,date,user_email,user_url,user_name,parent_id,
+ client_ip,send_notification,status,spam_rate,properties
+ FROM ".$this->getPrefix()."articles_comments
WHERE id = $id";
$result = $this->Execute( $query );
Modified: plog/branches/plog-1.0.1/class/dao/articles.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/dao/articles.class.php 2005-04-05 19:17:36 UTC (rev 1751)
+++ plog/branches/plog-1.0.1/class/dao/articles.class.php 2005-04-05 19:23:17 UTC (rev 1752)
@@ -440,7 +440,7 @@
function getArticlesText( $articleIds )
{
$prefix = $this->getPrefix();
- $query = "SELECT * FROM {$prefix}articles_text WHERE
+ $query = "SELECT article_id,text,topic FROM {$prefix}articles_text WHERE
article_id IN (".$articleIds.")";
$result = $this->Execute( $query );
@@ -701,7 +701,7 @@
function getArticleText( $articleId )
{
$prefix = $this->getPrefix();
- $query = "SELECT * FROM {$prefix}articles_text
+ $query = "SELECT text,topic FROM {$prefix}articles_text
WHERE article_id = '".Db::qstr($articleId)."'";
$result = $this->Execute( $query );
More information about the pLog-svn
mailing list