Commit b2583b62 authored by Dries's avatar Dries

Patch by Ax:

- db_query_range() in database.mysql.inc wasn't updated to match
  db_query().

- Fixed phpdoc.
parent 583104ce
......@@ -118,18 +118,26 @@ function db_affected_rows() {
}
/**
* Generates a limited query
* Runs a LIMIT query in the database.
*
* @param string $query query
* @param integer $from the row to start to fetching
* @param integer $count the numbers of rows to fetch
*
* @access public
* @param mixed $query SQL query, followed by a variable number of arguments which are substituted into query by sprintf, followed by 'from' and 'count' parameters. 'from' is the row to start fetching, 'count' the numbers of rows to fetch.
* @return resource a MySQL result or FALSE if the query was not executed correctly.
* @access public
*/
function db_query_range($query, $from, $count) {
function db_query_range($query) {
$args = func_get_args();
$count = array_pop($args);
$from = array_pop($args);
if (count(func_get_args()) > 3) {
$args = array_map("check_query", $args);
$args[0] = $query;
$query = call_user_func_array("sprintf", $args);
}
else {
$query = func_get_arg(0);
}
$query .= " LIMIT $from, $count";
// TODO: debug version
return db_query($query);
return _db_query($query);
}
?>
\ No newline at end of file
?>
......@@ -18,9 +18,9 @@ function db_connect($url) {
/**
* Runs a query in the database.
*
* @param $query sql query
* @param $type module type of this item
* @return sql result resource
* @param $query SQL query
* @param $type module type of this item
* @return sql result resource
*/
function db_query($query) {
......@@ -130,9 +130,8 @@ function db_affected_rows() {
/**
* Runs a LIMIT query in the database.
*
* @param $query sql query followed by 'from' and 'count' parameters, followed by a variable number of arguments which are substituted into query by sprintf. 'from' is the row to start to fetching. 'count' the numbers of rows to fetch.
* @return mixed a DB_Result object or a DB_Error
*
* @param mixed $query SQL query followed by a variable number of arguments which are substituted into query by sprintf, followed by 'from' and 'count' parameters. 'from' is the row to start fetching, 'count' the numbers of rows to fetch.
* @return mixed a DB_Result object or a DB_Error
* @access public
*/
function db_query_range($query) {
......@@ -170,4 +169,4 @@ function db_query_range($query) {
}
}
?>
\ No newline at end of file
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment