db_query_range($query, $args, $from = 0, $count = 0, $options = array())
drupal/includes/database/database.inc, line 1573
Execute an arbitrary query string against the active database, restricted to a specified range.
@see DatabaseConnection::defaultOptions()
$query The prepared statement query to run. Although it will accept both named and unnamed placeholders, named placeholders are strongly preferred as they are more self-documenting.
$args An array of values to substitute into the query. If the query uses named placeholders, this is an associative array in any order. If the query uses unnamed placeholders (?), this is an indexed array and the order must match the order of placeholders in the query string.
$from The first record from the result set to return.
$limit The number of records to return from the result set.
$options An array of options to control how the query operates.
A prepared statement object, already executed.
| Name | Description |
|---|---|
| Database abstraction layer | Allow the use of different database servers using the same code base. |
function db_query_range($query, $args, $from = 0, $count = 0, $options = array()) {
if (!is_array($args)) {
$args = func_get_args();
array_shift($args);
$count = array_pop($args);
$from = array_pop($args);
}
list($query, $args, $options) = _db_query_process_args($query, $args, $options);
return Database::getActiveConnection($options['target'])->queryRange($query, $args, $from, $count, $options);
}