function messaging_store_get in Messaging 6
Same name and namespace in other branches
- 5 messaging.store.inc \messaging_store_get()
- 6.2 messaging.store.inc \messaging_store_get()
- 6.3 messaging.store.inc \messaging_store_get()
Retrieve from messaging database storage
Parameters
$params: Array of field value pairs
$order: Optional array of field names to order by
$limit: Optional maximum number of rows to retrieve
$pager: Optional pager element for pager queries
$unpack: Optional fully load stored data
1 call to messaging_store_get()
- messaging_pull_pending in ./
messaging.module - Pull pending messages for given methods and user accounts
File
- ./
messaging.store.inc, line 114 - Database storage for the messaging framework
Code
function messaging_store_get($params, $order = NULL, $limit = NULL, $pager = NULL, $unpack = FALSE) {
$messages = $where = $args = array();
list($where, $args) = messaging_store_query($params);
$sql = 'SELECT * FROM {messaging_store}';
$sql .= $where ? ' WHERE ' . implode(' AND ', $where) : '';
$sql .= $order ? ' ORDER BY ' . implode(', ', $order) : '';
if (!is_null($pager)) {
$result = pager_query($sql, $limit, $pager, NULL, $args);
}
elseif ($limit) {
$result = db_query_range($sql, $args, 0, $limit);
}
else {
$result = db_query($sql, $args);
}
while ($msg = db_fetch_object($result)) {
messaging_store_unpack($msg, $unpack);
$messages[$msg->mqid] = $msg;
}
return $messages;
}