You are here

function notifications_queue_query in Notifications 6.3

Same name and namespace in other branches
  1. 5 notifications.cron.inc \notifications_queue_query()
  2. 6 notifications.cron.inc \notifications_queue_query()
  3. 6.2 notifications.cron.inc \notifications_queue_query()

Build query conditions for queue queries

Parameters

$params: Array of parameters, field => value form Special parameters 'max_squid' => max squid to delete 'rows' => array of squid values to delte

Return value

Array with 'where' and 'args' elements. Each of them is an array

4 calls to notifications_queue_query()
NotificationsBasicTests::countQueued in tests/notifications_api.test
Helper function. Simple row counting with conditions, uses query builder
notifications_process_rows in ./notifications.cron.inc
Process rows given query conditions
notifications_queue_delete in ./notifications.cron.inc
Delete rows from subscriptions queue
notifications_queue_update in ./notifications.cron.inc
Update queue rows with defined values

File

./notifications.cron.inc, line 704

Code

function notifications_queue_query($params) {
  $where = $args = array();

  // Special condition max_sqid
  if (isset($params['max_sqid'])) {
    $where[] = "sqid <= %d";
    $args[] = $params['max_sqid'];
    unset($params['max_sqid']);
  }

  // User generic query builder for the rest of fields
  $values = _messaging_query_conditions('notifications_queue', $params);
  $where = array_merge($where, $values['conditions']);
  $args = array_merge($args, $values['args']);
  return array(
    'where' => $where,
    'args' => $args,
  );
}