Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: Argument problem when using a perl script

by graff (Chancellor)
on Apr 12, 2016 at 22:28 UTC ( #1160268=note: print w/replies, xml ) Need Help??

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:
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
(updated code to add missing sigil)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1160268]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2021-02-27 16:13 GMT
Find Nodes?
    Voting Booth?

    No recent polls found