You are here

function notifications_queue_query in Notifications 5

Same name and namespace in other branches
  1. 6 notifications.cron.inc \notifications_queue_query()
  2. 6.2 notifications.cron.inc \notifications_queue_query()
  3. 6.3 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

2 calls to notifications_queue_query()
notifications_process_rows in ./notifications.cron.inc
Process rows given query conditions
notifications_queue_delete in ./notifications.cron.inc
Delete rows from subscriptions queue

File

./notifications.cron.inc, line 670

Code

function notifications_queue_query($params) {
  $where = $args = array();
  foreach ($params as $field => $value) {
    switch ($field) {
      case 'max_sqid':
        $where[] = "sqid <= %d";
        $args[] = $value;
        break;
      case 'sqids':
        $where[] = "sqid IN (%s)";
        $args[] = implode(',', array_map('db_escape_string', $value));
        break;
      default:
        $where[] = "{$field} = '%s'";
        $args[] = $value;
        break;
    }
  }
  return array(
    'where' => $where,
    'args' => $args,
  );
}