Home » Database » DB_DataObject » Bug #7641
update
Details
| Submitted | 2006-05-16 15:28 UTC |
|---|---|
| From | spenhoet at yahoo dot com |
| Status | Bogus |
| Package | DB_DataObject |
| PHP Version | 4.4.1 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2006-05-16 15:28 UTC] spenhoet at yahoo dot com
Description:
------------
We are trying to update a row using a dataobject.
The primary key is based on a couple of attributes. We therefore use the whereAdd method in order to select the row to update.
Unfortunately, when we define the new value for the attribute we want to alter, it appears with its new value in both de "update" and "where" statement of the generated SQL.
(BTW, we tried and update this same table using the update method with a parameter, with the same result).
The "FERME" field is not part of the primary key.
Test script:
---------------
PHP code :
(...)
$tuple = new DBDO_XXMI_DEST_NOTIF;
$tuple->FERME='O';
$tuple->whereAdd(' notification_id = ' . $num_notification . ' and ' . ' user_id = ' . $id_user);
$res = $tuple->update();
Expected result:
----------------
Generated SQL :
UPDATE XXMI_DEST_NOTIF SET FERME = 'O' WHERE ( notification_id = 1 and user_id = 41 )
Actual result:
--------------
Generated SQL :
UPDATE XXMI_DEST_NOTIF SET FERME = 'O' WHERE ( notification_id = 1 and user_id = 41 ) AND ( XXMI_DEST_NOTIF.FERME = 'O' )
[2006-05-17 11:58 UTC] spenhoet at yahoo dot com
I just did, and it works fine.
Thanx.