From: Michael J. Rubinsky Date: Thu, 4 Nov 2010 05:35:04 +0000 (-0400) Subject: Standardize on only returning result hashes, not offsets. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a2d19ece47802e7a9bed4749500871404ca290b8;p=horde.git Standardize on only returning result hashes, not offsets. Use the various *_ASSOC constants instead of the *_ALL constants --- diff --git a/framework/Db/lib/Horde/Db/Adapter/Mysql.php b/framework/Db/lib/Horde/Db/Adapter/Mysql.php index e828bb21c..3f11e42c2 100644 --- a/framework/Db/lib/Horde/Db/Adapter/Mysql.php +++ b/framework/Db/lib/Horde/Db/Adapter/Mysql.php @@ -177,7 +177,7 @@ class Horde_Db_Adapter_Mysql extends Horde_Db_Adapter_Base $result = $this->execute($sql, $arg1, $arg2); $rows = array(); if ($result) { - while ($row = mysql_fetch_array($result)) { + while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $rows[] = $row; } } @@ -196,7 +196,7 @@ class Horde_Db_Adapter_Mysql extends Horde_Db_Adapter_Base public function selectOne($sql, $arg1=null, $arg2=null) { $result = $this->execute($sql, $arg1, $arg2); - return $result ? mysql_fetch_array($result) : array(); + return $result ? mysql_fetch_array($result, MYSQL_ASSOC) : array(); } /** diff --git a/framework/Db/lib/Horde/Db/Adapter/Mysqli.php b/framework/Db/lib/Horde/Db/Adapter/Mysqli.php index a5d13789b..a8c2f9d5e 100644 --- a/framework/Db/lib/Horde/Db/Adapter/Mysqli.php +++ b/framework/Db/lib/Horde/Db/Adapter/Mysqli.php @@ -226,11 +226,11 @@ class Horde_Db_Adapter_Mysqli extends Horde_Db_Adapter_Base { $result = $this->execute($sql, $arg1, $arg2); if ($this->_hasMysqliFetchAll) { - return $result->fetch_all(MYSQLI_BOTH); + return $result->fetch_all(MYSQLI_ASSOC); } else { $rows = array(); if ($result) { - while ($row = $result->fetch_array()) { + while ($row = $result->fetch_array(MYSQLI_ASSOC)) { $rows[] = $row; } } diff --git a/framework/Db/lib/Horde/Db/Adapter/Pdo/Base.php b/framework/Db/lib/Horde/Db/Adapter/Pdo/Base.php index 05d196faa..88688968d 100644 --- a/framework/Db/lib/Horde/Db/Adapter/Pdo/Base.php +++ b/framework/Db/lib/Horde/Db/Adapter/Pdo/Base.php @@ -83,7 +83,7 @@ abstract class Horde_Db_Adapter_Pdo_Base extends Horde_Db_Adapter_Base public function selectAll($sql, $arg1=null, $arg2=null) { $result = $this->execute($sql, $arg1, $arg2); - return $result ? $result->fetchAll(PDO::FETCH_BOTH) : array(); + return $result ? $result->fetchAll(PDO::FETCH_ASSOC) : array(); } /** @@ -98,7 +98,7 @@ abstract class Horde_Db_Adapter_Pdo_Base extends Horde_Db_Adapter_Base public function selectOne($sql, $arg1=null, $arg2=null) { $result = $this->execute($sql, $arg1, $arg2); - return $result ? $result->fetch(PDO::FETCH_BOTH) : array(); + return $result ? $result->fetch(PDO::FETCH_ASSOC) : array(); } /**