2009年10月31日星期六

Re: [fw-db] weird Zend_Db_Table_Abstract behaviour

I'm sure all input parameters are valid... the problem only occurs if datas
don't need to be updated.

I can extend my question: how do you check db operation
(insert/update/delete) if something goes wrong?

bye


tfk wrote:
>
> 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.
>>
>>
>
>

--
View this message in context: http://old.nabble.com/weird-Zend_Db_Table_Abstract-behaviour-tp26136108p26144290.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: