in reply to DBI Prepared Update and NULLs
my %col; $col{foo}=1; $col{bar}=undef; my %vbph; my @vbval; foreach(sort keys %arg){ if(defined $arg{$_}){ $vbph{$_}='?'; push @vbval,$arg{$_}; }else{ $vbph{$_}='NULL'; } } my $sql='update baz set '. join ', ',(map{$_.'='.$vb{$_}} sort keys %arg)); my $sth=$dbh->prepare_cached($sql); $sth->execute(@vbval);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: DBI Prepared Update and NULLs
by paulbort (Hermit) on Jul 28, 2004 at 20:58 UTC |