Commit 4e5d3e04 authored by Dries's avatar Dries

- Patch #159748 by pwolanin: db_fetch_array() returned different values...

- Patch #159748 by pwolanin: db_fetch_array() returned different values depending on the database engine used.  Make the return value consistent across all supported database backends.
parent a4663548
......@@ -165,8 +165,8 @@ function _db_query($query, $debug = 0) {
* @param $result
* A database query result resource, as returned from db_query().
* @return
* An object representing the next row of the result. The attributes of this
* object are the table fields selected by the query.
* An object representing the next row of the result, or FALSE. The attributes
* of this object are the table fields selected by the query.
*/
function db_fetch_object($result) {
if ($result) {
......@@ -180,9 +180,9 @@ function db_fetch_object($result) {
* @param $result
* A database query result resource, as returned from db_query().
* @return
* An associative array representing the next row of the result. The keys of
* this object are the names of the table fields selected by the query, and
* the values are the field values for this result row.
* An associative array representing the next row of the result, or FALSE.
* The keys of this object are the names of the table fields selected by the
* query, and the values are the field values for this result row.
*/
function db_fetch_array($result) {
if ($result) {
......
......@@ -162,12 +162,13 @@ function _db_query($query, $debug = 0) {
* @param $result
* A database query result resource, as returned from db_query().
* @return
* An object representing the next row of the result. The attributes of this
* object are the table fields selected by the query.
* An object representing the next row of the result, or FALSE. The attributes
* of this object are the table fields selected by the query.
*/
function db_fetch_object($result) {
if ($result) {
return mysqli_fetch_object($result);
$object = mysqli_fetch_object($result);
return isset($object) ? $object : FALSE;
}
}
......@@ -177,13 +178,14 @@ function db_fetch_object($result) {
* @param $result
* A database query result resource, as returned from db_query().
* @return
* An associative array representing the next row of the result. The keys of
* this object are the names of the table fields selected by the query, and
* the values are the field values for this result row.
* An associative array representing the next row of the result, or FALSE.
* The keys of this object are the names of the table fields selected by the
* query, and the values are the field values for this result row.
*/
function db_fetch_array($result) {
if ($result) {
return mysqli_fetch_array($result, MYSQLI_ASSOC);
$array = mysqli_fetch_array($result, MYSQLI_ASSOC);
return isset($array) ? $array : FALSE;
}
}
......
......@@ -182,8 +182,8 @@ function _db_query($query, $debug = 0) {
* @param $result
* A database query result resource, as returned from db_query().
* @return
* An object representing the next row of the result. The attributes of this
* object are the table fields selected by the query.
* An object representing the next row of the result, or FALSE. The attributes
* of this object are the table fields selected by the query.
*/
function db_fetch_object($result) {
if ($result) {
......@@ -197,9 +197,9 @@ function db_fetch_object($result) {
* @param $result
* A database query result resource, as returned from db_query().
* @return
* An associative array representing the next row of the result. The keys of
* this object are the names of the table fields selected by the query, and
* the values are the field values for this result row.
* An associative array representing the next row of the result, or FALSE.
* The keys of this object are the names of the table fields selected by the
* query, and the values are the field values for this result row.
*/
function db_fetch_array($result) {
if ($result) {
......
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