cvs: php4 /pear/DB common.php
| From: | Andrei Zmievski | Date: | Wed, 13 Sep 2000 20:58:44 +0000 |
| Subject: | cvs: php4 /pear/DB common.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1753@lists.php.net to get a copy of this message | ||
andrei Wed Sep 13 13:58:44 2000 EDT
Modified files:
/php4/pear/DB common.php
Log:
Fixed DB::getAll() to respect DB_FETCHMODE_FLIPPED.
Index: php4/pear/DB/common.php
diff -u php4/pear/DB/common.php:1.21 php4/pear/DB/common.php:1.22
--- php4/pear/DB/common.php:1.21 Wed Sep 13 04:27:59 2000
+++ php4/pear/DB/common.php Wed Sep 13 13:58:44 2000
@@ -556,14 +556,11 @@
// {{{ getAll()
/**
- * Fetch all the rows returned from a query. The resulting array is indexed
- * either by column names from the query or numerically with the numbers
- * corresponding to the order of columns from the query. Each key contains
- * an array of all the rows for that column.
+ * Fetch all the rows returned from a query.
*
* @param $query the SQL query
*
- * @return array an indexed array, or a DB error
+ * @return array an nested array, or a DB error
*/
function &getAll($query, $fetchmode = DB_FETCHMODE_DEFAULT, $params = array()) {
if ($fetchmode == DB_FETCHMODE_DEFAULT) {
@@ -583,8 +580,12 @@
}
$results = array();
while (($row = $this->fetchRow($res, $fetchmode)) && !DB::isError($row)) {
- foreach ($row as $key => $val) {
- $results[$key][] = $val;
+ if ($fetchmode & DB_FETCHMODE_FLIPPED) {
+ foreach ($row as $key => $val) {
+ $results[$key][] = $val;
+ }
+ } else {
+ $results[] = $row;
}
}
$this->freeResult($res);