2009年10月30日星期五

Re: [fw-db] weird Zend_Db_Table_Abstract behaviour

On Fri, Oct 30, 2009 at 9:00 PM, nulele <nulele@gmail.com> wrote:
>
> Hello,
> I don't know why, but when I call the method below and there's nothing to
> update (datas are not changed) it returns false... I mean is this normal?
> Even if datas are not changed I would expect a successful result of the
> update operation... it simply would update nothing!!
>
> class Model_DbTable_Users extends Zend_Db_Table_Abstract
> {
>        protected $_name = 'users';
>        protected $_primary = 'id_user';
>
> ....
>
>        public function updateData($data, $id)
>        {
>                $id = (int)$id;

Maybe $id is casted to 0 here, and nothing matches?

Till

>        if($this->update($data, "id_user = " . $id))
>        {
>                return true;
>        }
>        return false;
>        }
>
> ...
>
> }
>
> Maybe the problem could be NOT NULL fileds in the db?
> I know, would be better to include the update code in a try/catch statement,
> but I want to hear your opinion on this weird behaviour.
>
> Thanks
> --
> View this message in context: http://old.nabble.com/weird-Zend_Db_Table_Abstract-behaviour-tp26136108p26136108.html
> Sent from the Zend DB mailing list archive at Nabble.com.
>
>

没有评论: