cvs: pear /DB_DataObject DataObject.php
| From: | Alan Knowles | Date: | Sat, 17 Sep 2005 04:00:17 +0000 |
| Subject: | cvs: pear /DB_DataObject DataObject.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-34822@lists.php.net to get a copy of this message | ||
alan_k Sat Sep 17 00:00:17 2005 EDT
Modified files:
/pear/DB_DataObject DataObject.php
Log:
fix bug #5435 - find(true) returns false if numRows is not available and first fetch fails
http://cvs.php.net/diff.php/pear/DB_DataObject/DataObject.php?r1=1.371&r2=1.372&ty=u
Index: pear/DB_DataObject/DataObject.php
diff -u pear/DB_DataObject/DataObject.php:1.371 pear/DB_DataObject/DataObject.php:1.372
--- pear/DB_DataObject/DataObject.php:1.371 Wed Sep 7 01:56:08 2005
+++ pear/DB_DataObject/DataObject.php Sat Sep 17 00:00:15 2005
@@ -15,7 +15,7 @@
* @author Alan Knowles <alan@akbkhome.com>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: DataObject.php,v 1.371 2005/09/07 05:56:08 alan_k Exp $
+ * @version CVS: $Id: DataObject.php,v 1.372 2005/09/17 04:00:15 alan_k Exp $
* @link http://pear.php.net/package/DB_DataObject
*/
@@ -398,7 +398,7 @@
}
if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
- $this->debug($n, "__find",1);
+ $this->debug($n, "find",1);
}
if (!$this->__table) {
// xdebug can backtrace this!
@@ -440,22 +440,26 @@
$this->_query($sql);
if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
- $this->debug("CHECK autofetchd $n", "__find", 1);
+ $this->debug("CHECK autofetchd $n", "find", 1);
}
- // unset the
+ // find(true)
+ $ret = $this->N;
if ($n && $this->N > 0 ) {
- if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
- $this->debug("ABOUT TO AUTOFETCH", "__find", 1);
+ if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
+ $this->debug("ABOUT TO AUTOFETCH", "find", 1);
}
- $this->fetch() ;
+ $fs = $this->fetch();
+ // if fetch returns false (eg. failed), then the backend doesnt support numRows (eg.
ret=true)
+ // - hence find() also returns false..
+ $ret = ($ret === true) ? $fs : $ret;
}
if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
- $this->debug("DONE", "__find", 1);
+ $this->debug("DONE", "find", 1);
}
$this->_query = $query_before;
- return $this->N;
+ return $ret;
}
/**