On Tue, Apr 05, 2005 at 09:29:59AM +0100, Steve Hay wrote:
> Stephen Clouse wrote:
> >On Mon, Apr 04, 2005 at 03:41:56PM +0100, Steve Hay wrote:
> >
> >>Binding parameters: UPDATE foo SET str = 'one', num = 1.#INF WHERE 
> >>id = 1
> >
> >You're being bitten by two things:
> >
> >1. MySQL doesn't actually support placeholders; DBD::mysql emulates them by 
> >   interpolating the value into the SQL directly.
> >
> >2. MySQL allows # as an alternative to the ANSI --, to start a comment that 
> >goes 
> >   to end-of-line.
> >
> >Knowing those two things, I think you can figure out why your SQL is giving 
> >such 
> >bizarre results.
>
> I hadn't realised either of those two facts, but guessed that # must be 
> interpreted by MySQL as a comment-introducer.
> 
> I still think that it could have done better, though.  If the "1.#INF" 
> had been quoted in the SQL statement that was generated then it would 
> have worked fine, and I think that it should have been quoted since 
> DBI::looks_like_number() returns false for the string "1.#INF".

I agree that drivers using emulated placeholders should use
looks_like_number() as a final check before adding a supposedly numeric
(SQL_INTEGER, SQL_FLOAT etc) value without quotes.

Tim.

Reply via email to