On Sun, Dec 01, 2002 at 06:17:48PM +0000, Tony Bowden wrote: > On Fri, Nov 29, 2002 at 12:33:42PM +0100, Bart Lateur wrote: > > I hadn't looked at this thread until now, but now that I do, I do > > recognize the pattern. I've had the same kind of problems with Access. > > What can fix this, is having an explicit bind on the variable type, > > after the pepare phase, but before the first time you execute this > > statement. It certainly did help in Access. My code (adapted) looked > > like this: > > use DBI ':sql_types'; # to import the constants > > $sth->bind_param(2, undef, SQL_VARCHAR); > > $sth->bind_param(1, undef, SQL_INTEGER); > > Yeah ... unfortunately I have to think of some way to deal with this for > Class::DBI users ... and forcing them to specify this like this isn't > really ideal.... > > I think my main surprise is that this hasn't bitten people more often. > There are probably quite a lot of applications out there that will break > if the first user ever inserts an all-numeric value for what's normally > a text field.
I think the drivers that emilate placeholders could be changed to at least catch the case of a non-looks_like_number() value being bound to a placeholder that the driver has decided to treat as numeric. The perl internal looks_like_number() function is fast enough that it could be used all the time as a check on numeric typed placeholders. Tim.