Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Difference between inline SQL and bound data

by polettix (Vicar)
on May 17, 2010 at 15:46 UTC ( [id://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?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found