On Mon, 20 Aug 2001, Philip Molter wrote:

> On Mon, Aug 20, 2001 at 02:16:13PM -0230, Chad House wrote:
>: I've run into a peculiar bug when running some code under mod_perl
>: that doesn't show up outside the mod_perl environment.
>: 
>: I have some insert code that looks like this:
>: 
>: 
>:   my $sth = $dbh->prepare(q{insert into metadata (id, property,
>:   value)
>:                             values (?,?,?)}) or die $dbh->errstr;
>: 
>:   my $count = 0;
>:   while (my ($property, $value) = each %{$self->{_meta}}) {
>:     $sth->execute($self->{_id}, $property, $value) or return;
>:     $count++;
>:   }
> 
> We've had a problem similar to this. By default, the DBI seems to
> treat numbers as INTEGER fields, which don't need quoting. Our
> experience has been that it makes this determination on the first
> call to execute() and then caches it. So, if you're actually putting
> in mixed data (INTEGER and CHAR or VARCHAR data), then you're
> playing Russian roulette with your data. You experience it under
> mod_perl because your handle is most likely remaining in memory.

Ah, yes that makes sense. I'll make the bind_param's explict about the
data type. Thanks!

Chad

Reply via email to