in reply to Re: Argument problem when using a perl script
in thread Argument problem when using a perl script
Note that if a valid/actionable return from $oracle_connector->opts->condition could be the string "0", then we wouldn't want this to evaluate to false (and skip the "where" clause). Also, in case the return from that function call might contain an apostrophe, we'd want to use a placeholder for the value in the SQL statement:
(updated code to add missing sigil)my $condition = $oracle_connector->opts->condition; my @bind_values = (); my $where = ""; if ( $condition =~ /\S/ ) { push @bind_values, $condition; $where = " WHERE status = ?"; } my $sth = $db->prepare("SELECT COUNT(*) from CONNECTOR.$table$where"); $sth->execute( @bind_values ); # works as intended if @bind_values is + empty
|
---|
In Section
Seekers of Perl Wisdom