On Sun, Jun 22, 2003 at 04:10:23PM -0700, Michael A Chase wrote:
> 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.

Perhaps. I'd like to know where and why though. Robbie, please use
trace() to see what's going on and let us know. Thanks.

Tim.

>    $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