Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: DBI variable argument count

by NetWallah (Abbot)
on Sep 13, 2012 at 22:27 UTC ( #993592=note: print w/ replies, xml ) Need Help??


in reply to DBI variable argument count

Try this: (pseudocode)

my $sth = $dbh->prepare( $sql ); my @var_args = ($bar); # if at least one arg if (Some-condition){ push @var_args, $baz; # others, as needed } $sth->execute( @var_args );
Update: Corrected declaration of my @var_args

             I hope life isn't a big joke, because I don't get it.
                   -SNL


Comment on Re: DBI variable argument count
Download Code
Replies are listed 'Best First'.
Re^2: DBI variable argument count
by anothersmurf (Novice) on Sep 13, 2012 at 22:41 UTC

    I see. I must have messed something up when I tried to pass an array to execute() instead of the individual comma-delimited scalars.

    Thank you.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2015-07-30 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls