svn: /pear/packages/DB_DataObject/trunk/ DataObject.php

From: Date: Mon, 21 Nov 2011 08:55:58 +0000
Subject: svn: /pear/packages/DB_DataObject/trunk/ DataObject.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-62770@lists.php.net to get a copy of this message
alan_k Mon, 21 Nov 2011 08:55:58 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=319602 Log: find() will return false when an error occurs (rather than 0) Changed paths: U pear/packages/DB_DataObject/trunk/DataObject.php Modified: pear/packages/DB_DataObject/trunk/DataObject.php =================================================================== --- pear/packages/DB_DataObject/trunk/DataObject.php 2011-11-21 08:21:25 UTC (rev 319601) +++ pear/packages/DB_DataObject/trunk/DataObject.php 2011-11-21 08:55:58 UTC (rev 319602) @@ -414,6 +414,10 @@ * will set $object->N to number of rows, and expects next command to fetch rows * will return $object->N * + * if an error occurs $object->N will be set to false and return value will also be false; + * if numRows is not supported it will + * + * * @param boolean $n Fetch first result * @access public * @return mixed (number of rows returned, or true if numRows fetching is not supported) @@ -473,7 +477,10 @@ } - $this->_query($sql); + $err = $this->_query($sql); + if (is_a($err,'PEAR_Error')) { + return false; + } if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug("CHECK autofetchd $n", "find", 1); @@ -2589,6 +2596,7 @@ if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug($result->toString(), "Query Error",1 ); } + $this->N = false; return $this->raiseError($result); } if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {

« previous php.pear.cvs (#62770) next »