You are here

function queue_example_retrieve_queue in Examples for Developers 7

Retrieves the queue from the database for display purposes only.

It is not recommended to access the database directly, and this is only here so that the user interface can give a good idea of what's going on in the queue.

Parameters

array $queue_name: The name of the queue from which to fetch items.

Related topics

2 calls to queue_example_retrieve_queue()
QueueExampleTestCase::testQueueExampleBasic in queue_example/queue_example.test
Test the queue behavior through user interaction.
queue_example_add_remove_form in queue_example/queue_example.module
Form generator for managing the queue.

File

queue_example/queue_example.module, line 289
Examples demonstrating the Drupal Queue API.

Code

function queue_example_retrieve_queue($queue_name) {
  $items = array();
  $result = db_query("SELECT item_id, data, expire, created FROM {queue} WHERE name = :name ORDER BY item_id", array(
    ':name' => $queue_name,
  ), array(
    'fetch' => PDO::FETCH_ASSOC,
  ));
  foreach ($result as $item) {
    $items[] = $item;
  }
  return $items;
}