Re: update query returns wrong number of rows affected
Dave Dyer <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
> UPDATE thetable
> SET thecol = $new_value
> WHERE thecol <> new_value
More like
UPDATE thetable SET a1=b1,a2-b2 ... WHERE a1!=b1 OR a2!=b2 ...
This would not be in my A-list of paradigms.
There are all sorts of potential complications because the
semantics of assignment are not exactly the same as the
semantics of comparison. Consider nulls on either side
of the assignment, mismatches in ENUM types, illegal
assignments due to unique keys, case mismatch of strings,
simple typos if you fail to maintain the two lists of = and !=
clauses exactly the same ... the list is probably much longer.
If I'm trying to implement a simple, reliable trigger:
if (<this update changes anything>) { <flush caches or whatver> }
I really want the functionality from the C api
You may be correct that if some databases hide the information,
such a capability would be nonportable.
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]