You are here

public static function SuggestionStorage::getCount in Autocomplete Search Suggestions 7

Fetch the row count.

Parameters

string $ngram: The text to search for.

Return value

int The number of rows in the suggestion table.

1 call to SuggestionStorage::getCount()
suggestion_admin_search_form in ./suggestion.admin.inc
Menu callback to index suggestions.

File

src/SuggestionStorage.php, line 121
CRUD methods for the suggestion module.

Class

SuggestionStorage
Database CRUD.

Code

public static function getCount($ngram = '') {
  if ($ngram) {
    return db_query("SELECT COUNT(*) FROM {suggestion} WHERE ngram LIKE :ngram", array(
      ':ngram' => $ngram,
    ))
      ->fetchField();
  }
  return db_query("SELECT COUNT(*) FROM {suggestion}")
    ->fetchField();
}