Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.3

Bug #2926 Where clause not being added in buildManipSQL
Submitted: 2004-12-08 20:10 UTC
From: jrust at php dot net Assigned: danielc
Status: Wont fix Package: DB
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 25 - 9 = ?

 
 [2004-12-08 20:10 UTC] jrust at php dot net
Description: ------------ It is entirely possible that an autogenerated where statement would be just 0, in which case the UPDATE statement should not affect any rows. However, in the current code, such a where statement causes all rows to be affected! Reproduce code: --------------- $query = $db->buildManipSQL('table', array('id'), DB_AUTOQUERY_UPDATE, 0); echo $query; UPDATE table SET id = ?; To fix: Change line 907 to: if ($where !== false) { Expected result: ---------------- UPDATE table SET id = ? WHERE 0;

Comments

 [2004-12-08 20:51 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-12-08 21:45 UTC] jrust at php dot net
True, it is not the best SQL. However, if a developer wants the WHERE clause to be 0 the method should not prevent them from doing so. The fact is that they are passing 0, not false as the value for $where and the variable is not being evaluated correctly.
 [2004-12-08 21:53 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!