Patch by Ax:

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

- Fixed phpdoc.
4.2.x
Dries Buytaert 2003-03-16 17:38:51 +00:00
parent 583104ce28
commit b2583b624c
2 changed files with 24 additions and 17 deletions

View File

@ -118,18 +118,26 @@ function db_affected_rows() {
}
/**
* Generates a limited query
*
* @param string $query query
* @param integer $from the row to start to fetching
* @param integer $count the numbers of rows to fetch
* Runs a LIMIT query in the database.
*
* @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);
}
?>

View File

@ -18,7 +18,7 @@ function db_connect($url) {
/**
* Runs a query in the database.
*
* @param $query sql query
* @param $query SQL query
* @param $type module type of this item
* @return sql result resource
*/
@ -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.
* @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) {