On Wed, Jun 25, 2003 at 05:37:31AM -0700, Michael A Chase wrote:
> On Tue, 24 Jun 2003 18:42:54 +0100 Robbie Armour <[EMAIL PROTECTED]> wrote:
> 
> > I guess so - no special action is required if you store numbers in a
> > varchar field in MySQL, only text (longtext or mediumtext too).
> > Also, the same thing works OK with an Oracle long field.
> 
> >> From: Hardy Merrill <[EMAIL PROTECTED]>
> >> To: Robbie Armour <[EMAIL PROTECTED]>
> >> CC: [EMAIL PROTECTED]
> >> Subject: Re: Rounding errors storing numbers in MySQL text fields
> >> using DBI
> >> Date: Tue, 24 Jun 2003 11:56:24 -0400
> >>
> >>Robbie Armour [EMAIL PROTECTED] wrote:
> >>> That's it!  - 0.4444 then '0.4444'  fails whereas '0.4444',
> >>> 0.4444 works.
> >>> I shall put something in my code to circumvent this.
> 
> A dummy bind_param() with a string in it before the real bind_param()
> calls should work.
> 
> >> Hold on - I realize I'm being thick here, but what does
> >> that prove?  The original problem was that 0.4444 ended
> >> up coming out of MySQL as 0.44, right?  What is the
> >> resolution?
> 
> My guess is that DBD::mysql realizes that input to a VARCHAR column is
> always a string, but for TEXT columns it falls back on the type of the
> parameter value ( "0.4444" is a string, but 0.4444 is a number).  Once
> the type of the 'placeholder' is established, its characteristics are
> used from then on.  I say 'placeholder' because DBD::mysql simulates
> placeholders by pasting the parameter values in place of the
> placeholder markers after quote()ing them as it thinks appropriate.

So far no one has explained why/how/where 0.4444 or "0.4444" becomes 0.44.

Tim.

Reply via email to