You are here

function votingapi_select_results in Voting API 6

Same name and namespace in other branches
  1. 6.2 votingapi.module \votingapi_select_results()
  2. 7.2 votingapi.module \votingapi_select_results()

Select cached vote results from the database.

Parameters

$criteria: A keyed array used to build the select query. Keys can contain a single value or an array of values to be matched. $criteria['vote_cache_id'] (If this is set, all other keyes are skipped) $criteria['content_type'] $criteria['content_type'] $criteria['value_type'] $criteria['tag'] $criteria['uid'] $criteria['vote_source'] $criteria['timestamp'] (If this is set, records with timestamps GREATER THAN the set value will be selected.)

Return value

An array of vote result objects matching the criteria.

1 call to votingapi_select_results()
votingapi_recalculate_results in ./votingapi.module
Loads all votes for a given piece of content, then calculates and caches the aggregate vote results. This is only intended for modules that have assumed responsibility for the full voting cycle: the votingapi_set_vote() function recalculates…

File

./votingapi.module, line 319

Code

function votingapi_select_results($criteria = array()) {
  $cached = array();
  $result = _votingapi_query('cache', $criteria);
  while ($cache = db_fetch_object($result)) {
    $cached[] = $cache;
  }
  return $cached;
}