Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Difference between inline SQL and bound data

by polettix (Vicar)
on May 17, 2010 at 15:46 UTC ( #840384=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Difference between inline SQL and bound data
in thread Difference between inline SQL and bound data

You have a point. What I suspect it's happening is the following:

  • in the INSERT, Perl does the string-to-double conversion and provides MySql with it. In turn, MySql coerces this value to comply with the FLOAT(8,6) definition set by the OP
  • in the first SELECT, either MySql's definition of the provided numbers kicks in, or some kind of string comparison is performed and makes the test pass. In either case we're confronting the provided values with the coerced value;
  • in the second SELECT, Perl does the string-to-double conversion and provides MySql with it. In turn, this time MySql does NOT apply the FLOAT coercion as in the INSERT, but goes straight to the comparison (possibly upgrading the "limited" float to the same "size" of the provided value, like when you do this kind of comparisons in C)
The bottom line remains moritz's: floats and exact comparisons have to be specifically dealt with.

perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Io ho capito... ma tu che hai detto?


Comment on Re^3: Difference between inline SQL and bound data
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://840384]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-09-16 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (158 votes), past polls