On Sun, 22 Jun 2003 03:29:39 +0100 Robbie Armour <[EMAIL PROTECTED]> wrote:

> I use MySQL text fields as general repositories for code, data etc
> but find that numbers are rounded to two decimal places.  This does
> not happen with a similarly constructed Oracle table - eg
> 
>   my $c = $dbh->prepare("insert into test (t1) values (?)");
>   $c->execute(0.4444);
>   $c->execute(0.5555);
> 
> results in 0.44 and 0.56 being stored in the text field.  If field t1 is 
> varchar this does not happen.

If you are storing those values in text fields, you should probably
pass them to execute() as strings rather than numbers.  Since
DBD::mysql simulates placeholders, they are probably being pasted into
the SQL as numbers which get rounded or truncated as the driver sees
fit.

   $c->execute( "0.4444" );
   $c->execute( "0.5555" );

-- 
Mac :})
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to