You are here

function votingapi_votingapi_storage_select_votes in Voting API 6.2

Same name and namespace in other branches
  1. 7.2 votingapi.module \votingapi_votingapi_storage_select_votes()

Implementation of hook_votingapi_storage_select_votes().

File

./votingapi.module, line 201
A generalized voting API for Drupal.

Code

function votingapi_votingapi_storage_select_votes($criteria, $limit) {
  $query = db_select('votingapi_vote')
    ->fields('votingapi_vote');
  foreach ($criteria as $key => $value) {
    $query
      ->condition($key, $value, is_array($value) ? 'IN' : '=');
  }
  if (!empty($limit)) {
    $query
      ->range(0, $limit);
  }
  return $query
    ->execute()
    ->fetchAll(PDO::FETCH_ASSOC);
}