On 29 Jul 2003, Dan Rowles wrote:
> My problem is that I have a large code-base already installed that uses
> the "$sth->execute(@args)" way of parsing in placeholder values. This
> used to work fine. To go through and change all of these methods to do a
> "$sth->bind_param(n, $val, SQL_INTEGER)" is a lot of work!
That might have worked fine but if you had something like:
$args[3] = 'test';
.
.
.
for (1..9) {
print "HI" if $args[$_] >1;
}
$sth->execute(@args);
It would fail because DBD::mysql would not quote any of your arguemnts
because they were used in numeric context.
>
>
> I suppose there are really a couple of reasons for me posting:-
>
> 1) The $sth->execute(@args) way of running statements is *very* nice,
> and it's a shame that this has been broken (hint to DBI developers :).
The guessing was broken before, so now it quotes on the safe side
defaulting to quoting as a varchar() see the ChangeLog (btw, I just
noticed a typo in there -- bind_param(<colum_id>, SQL_INTEGER) should be
bind_param(<column_id>, undef, SQL_INTEGER).
> 2) Does anyone know if there's a way of getting the DBI to revert to
> it's old behaviour of not automatically quoting placeholder-values?
Nope.
Rudy