Standardize on only returning result hashes, not offsets.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 4 Nov 2010 05:35:04 +0000 (01:35 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 4 Nov 2010 05:35:04 +0000 (01:35 -0400)
Use the various *_ASSOC constants instead of the *_ALL constants

framework/Db/lib/Horde/Db/Adapter/Mysql.php
framework/Db/lib/Horde/Db/Adapter/Mysqli.php
framework/Db/lib/Horde/Db/Adapter/Pdo/Base.php

index e828bb2..3f11e42 100644 (file)
@@ -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();
     }
 
     /**
index a5d1378..a8c2f9d 100644 (file)
@@ -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;
                 }
             }
index 05d196f..8868896 100644 (file)
@@ -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();
     }
 
     /**