Re: DB_DataObject::update() raises error is zero rows effected?

From: Date: Fri, 14 May 2004 02:22:02 +0000
Subject: Re: DB_DataObject::update() raises error is zero rows effected?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12481@lists.php.net to get a copy of this message
It should be fixed in CVS. Regards Akab Mike Zornek wrote:
In the process of overriding update() in my own DataObject I noticed that if if no rows are effected by update() it returns false. The documentation make it seem like I would get zero back: <http://pear.php.net/manual/en/package.database.db-dataobject.db-dataobject. update.php>
Return value int number of rows affected or FALSE on failure
Zero rows does not mean failure (at least to me). Perhaps this should be changed? My .02 -- though am open-minded to hearing why it should be false. My current override looks like: function update($dataObject = false) {
        $ret = parent::update($dataObject);
    if ($ret === false) {
        return false;
    }
        // special stuff here
        return true;
} The reason I'm doing this is because my DataObject has an array or other DataObjects in it, and I need to call updates on them, when the top object gets update called on it. I'd like to have the error checking in place, but seeing as how I'm getting false instead of zero from the parent update (as I was expecting from the docs) it's hard to know if something went wrong or not. Please offer advice if you have it. Thanks!! ~ Mike ----- Mike Zornek Web Designer, Media Developer, Programmer and Geek Personal site: <http://MikeZornek.com> New Project: <http://WebDevWiki.com>
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.general (#12481) next »