I'm doing something like this (MySQL):

my $sql=q{replace into styles(field1,field2) values(?,?)};
my $sth=$dbh->prepare($sql);

sub enterStyles{
my($val1,$val2)=@_;
$sth->execute($val1,$val2) || die "Cannot execute: $DBI::errstr\n";
}

What I've found is that if $val1 is undefined, that the execute will be
succesfull and the inserted value will be 0.

The *next* execute will fail and the error message will return an error:
unknown field value checked (that is the value passed as the param).

Is there something I should know about passing undefined values to
placeholders (not something I plan on doing often!). That seemed to me
to be strange behaviour. Is that expected DBI behaviour or a quirk in
MySQL?

Jeff

Reply via email to