>>>>> "Atipat" == Atipat Rojnuckarin <[EMAIL PROTECTED]> writes:

Atipat> Hi,

Atipat>         I store numbers in FLOAT(8) column in mySQL. Most of them are
Atipat> very small (<1e-5), and when I do 'SELECT' (through perl DBI/DBD) most of
Atipat> them show up as 0.000. I have the following questions:

Atipat> 1. I couldn't find a format function for numbers that I can use to get my 
Atipat>    number in 'XXX.XXe+XX' format (ala sprintf("%g") in C/perl). Do I have
Atipat>    to resort to User-defined function? 

Sorry, we haven't had time to implement this yet.

The only possibility for the moment is to declare them as double and
use something like double(11,10);

One can't do this with a user defined function;  One should instead
have to implement a new type (real?) in MySQL

Atipat> 2. More importantly, should DBD::mysql perl module returns the "double"
Atipat>    representation of the results rather than just 0.000?

The problem is that MySQL returns all numbers to the client according
to the precision given when you created the table. In the above case
you have probably created the table with 3 decimals.

Atipat>         I am sure the number in the database is not zero because select
Atipat> X*1e+9 works as expected. I am using mySQL 3.22.14b-gamma for sgi-irix6.5
Atipat> I built from source distribution. The Perl interpreter used is 5.005_02,

Regards,
Monty
-----------------------------------------------------------
Send a mail to [EMAIL PROTECTED] with
unsubscribe mysql [EMAIL PROTECTED]
in the body of the message to unsubscribe from this list.

Reply via email to