13 Feb 2012 04:01
bind parameter guessing corrupts results
Marc Lehmann <schmorp <at> schmorp.de>
2012-02-13 03:01:35 GMT
2012-02-13 03:01:35 GMT
Hi! We today upgraded DBD::mysql to 4.020, and some of our scripts started to work very slowly. The reason was quickly found to be an integer that was stringified in the current version of DBD::mysql. In old versions of DBD::mysql, one could get reliable behaviour by using e.g. $num*1 # for numbers "string" # for strings it seems in current versions of DBD::mysql there is some autoguessing going on, which seems to be wrong in many cases, and doesn't seem to be documented at all. Worse, whoeveer wrote the documentation seems to think this is a performance issue in mysql only, however, this is a correctness issue, and in our case, this even corrupts the results. For example, in (my-)sql, the following statements do not have the same semantics: col < 10 col < "10" For col = 5, the first is true, the second is false, and an update statement using newer DBD::mysql would update the wrong rows, apart from potentially being slower.(Continue reading)
RSS Feed