diff --git a/lib/Views/aggregator/Plugin/views/argument/CategoryCid.php b/lib/Views/aggregator/Plugin/views/argument/CategoryCid.php index 2be3fdd..06c16f5 100644 --- a/lib/Views/aggregator/Plugin/views/argument/CategoryCid.php +++ b/lib/Views/aggregator/Plugin/views/argument/CategoryCid.php @@ -28,10 +28,7 @@ class CategoryCid extends Numeric { function title_query() { $titles = array(); - $query = db_select('aggregator_category', 'c'); - $query->addField('c', 'title'); - $query->condition('c.cid', $this->value); - $result = $query->execute(); + $result = db_query('SELECT title from {aggregator_category} WHERE cid = :cid', array(':cid' => $this->value)); foreach ($result as $term) { $titles[] = check_plain($term->title); } diff --git a/lib/Views/aggregator/Plugin/views/argument/Fid.php b/lib/Views/aggregator/Plugin/views/argument/Fid.php index 2561098..a68bccf 100644 --- a/lib/Views/aggregator/Plugin/views/argument/Fid.php +++ b/lib/Views/aggregator/Plugin/views/argument/Fid.php @@ -29,10 +29,6 @@ class Fid extends Numeric { $titles = array(); $result = db_query("SELECT f.title FROM {aggregator_feed} f WHERE f.fid IN (:fids)", array(':fids' => $this->value)); - $query = db_select('aggregator_feed', 'f'); - $query->addField('f', 'title'); - $query->condition('f.fid', $this->value); - $result = $query->execute(); foreach ($result as $term) { $titles[] = check_plain($term->title); } diff --git a/lib/Views/comment/Plugin/views/field/NodeNewComments.php b/lib/Views/comment/Plugin/views/field/NodeNewComments.php index fbc4979..96ec82d 100644 --- a/lib/Views/comment/Plugin/views/field/NodeNewComments.php +++ b/lib/Views/comment/Plugin/views/field/NodeNewComments.php @@ -78,15 +78,8 @@ class NodeNewComments extends Numeric { } if ($nids) { - $query = db_select('node', 'n'); - $query->addField('n', 'nid'); - $query->innerJoin('comment', 'c', 'n.nid = c.nid'); - $query->addExpression('COUNT(c.cid)', 'num_comments'); - $query->leftJoin('history', 'h', 'h.nid = n.nid'); - $query->condition('n.nid', $nids); - $query->where('c.changed > GREATEST(COALESCE(h.timestamp, :timestamp), :timestamp)', array(':timestamp' => NODE_NEW_LIMIT)); - $query->condition('c.status', COMMENT_PUBLISHED); - $query->groupBy('n.nid'); + $query = 'SELECT n.nid, COUNT(c.cid) as num_comments from {node} n INNER JOIN {comment} c ON n.nid = c.nid LEFT JOIN {history} h ON h.nid = n.nid WHERE n.nid IN :nids AND (c.changed > GREATEST(COALESCE(h.timestamp, :timestamp) AND c.status = :status GROUP BY n.nid'; + $result = db_query($query, array(':nids' => $nids, ':timestamp' => NODE_NEW_LIMIT, ':status' => COMMENT_PUBLISHED)); $result = $query->execute(); foreach ($result as $node) { foreach ($ids[$node->nid] as $id) {