countQuery

  1. drupal
    1. drupal7
Versionen
drupal7 public SelectQuery::countQuery()

Verwandte Themen

Code

includes/database/select.inc, line 1030

<?php
public function countQuery() {
  // Create our new query object that we will mutate into a count query.
  $count = clone($this);

  // Zero-out existing fields and expressions.
  $fields = & $count->getFields();
  $fields = array();
  $expressions = & $count->getExpressions();
  $expressions = array();


  // Also remove 'all_fields' statements, which are expanded into tablename.*
  // when the query is executed.
  foreach ($count->tables as $alias => &$table) {
    unset($table['all_fields']);
  }

  // Ordering a count query is a waste of cycles, and breaks on some
  // databases anyway.
  $orders = &$count->getOrderBy();
  $orders = array();

  // COUNT() is an expression, so we add that back in.
  $count->addExpression('COUNT(*)');

  return $count;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen