Hi,

I've been bugged by a bug in DAL update lately. The shortcut

     db.table[i] = dict(field=value,...)

fails with an error "No such record : i", even if the record 'i' definitely 
exists. 

I'm running against a MySQL database, and it turns out MySQL reports 0 
(records affected) on update if all the field values you mention in your 
dict() already has the new/correct values - it probably optimizes and check 
whether an actual record change really is needed.
The code causing the bug is in dal.py: Table.__setitem__() where one 
assumes 0 from "update" indicates an error, while it really is simply the 
number of rows "affected" - an error presumable results in an exception of 
some sort. So, the update is actually successful, but no records has been 
changed. The error message is definitely misleading/wrong.

My real question is how to proceed on reporting this bug... And for 
somebody else to consider the implications on other db drivers :-)

Best regards

Jens Andersen, Langhus, Norway

Reply via email to