Hi!
How-To-Repeat: (To avoid spam filter)
"BICHOT" == BICHOT Guilhem <172613 <guil...@ipsn.fr>> writes:
BICHOT> Description:
BICHOT> It is said that MySQL can automatically convert strings to numbers,
BICHOT> but here is an exception with a DECIMAL or INT column, in INSERT
BICHOT> and LOAD DATA. If the string is written in the xEy manner
BICHOT> (meaning x * 10^y),
BICHOT> then only the part before the "E" is kept by MySQL, leading
BICHOT> to bad values.
<cut>
Apparently we need to precise the rules a bit:
- If you try to use a string in a 'integer' context, the string will be
read as an integer. (basicly with the 'atoi()' C function)
This means that if you insert the string '1e2' into an integer
column only 1 will be inserted.
- If you try to use a string in a floating point context, the string will be
read as a floating point value. (basicly with the 'atof()' C function)
The reason for the above rules are:
- Speed
- Predictability (in a sense..)
- You will not get problems with integers that is outside of the
floating point precision.
- Its not easy to code a fast function that can read a longlong or
unsigned longlong value and also accept an exponent.
Regards,
Monty