summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-07-22 07:23:27 +0000
committerDries Buytaert <dries@buytaert.net>2007-07-22 07:23:27 +0000
commit4e5d3e04ea47d9ba5f3a9f58d8364a1bf9f9491a (patch)
tree17d7e5cba07a21ed56205cd55ba14c088e70896c /includes
parenta466354823cc7df7583062bfd69173a74465af16 (diff)
downloadbrdo-4e5d3e04ea47d9ba5f3a9f58d8364a1bf9f9491a.tar.gz
brdo-4e5d3e04ea47d9ba5f3a9f58d8364a1bf9f9491a.tar.bz2
- 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.
Diffstat (limited to 'includes')
-rw-r--r--includes/database.mysql.inc10
-rw-r--r--includes/database.mysqli.inc16
-rw-r--r--includes/database.pgsql.inc10
3 files changed, 19 insertions, 17 deletions
diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc
index c3c6b0710..f75b0e6ef 100644
--- a/includes/database.mysql.inc
+++ b/includes/database.mysql.inc
@@ -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) {
diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc
index 3bc058da8..cefeb69cd 100644
--- a/includes/database.mysqli.inc
+++ b/includes/database.mysqli.inc
@@ -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;
}
}
diff --git a/includes/database.pgsql.inc b/includes/database.pgsql.inc
index 051e8ea69..ca0603db8 100644
--- a/includes/database.pgsql.inc
+++ b/includes/database.pgsql.inc
@@ -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) {