in reply to Cleanup time
If I assume that you eventually have code like:
Then you can still use placeholders by pushing the data into another array, which is then passed to the execute() function:# @where_clause has been fully defined my $query = "SELECT * FROM $table WHERE "; $query .= join " AND ", @where_clause; my $sth->prepare( $query ) or die #stuff; $sth->execute( ) or die #stuff;
# From your code above: if (defined($allocated_to) && $allocated_to ne '') { push @where_clause, "UPPER(ALLOCATED_TO) LIKE UPPER(?)"; push @entries, 'ALLOCATED_TO'; push @values, '\%$allocated_to\%'; } # # yada yada yada # my $query = "SELECT * FROM $table WHERE "; $query .= join " AND ", @where_clause; my $sth->prepare( $query ) or die #stuff; $sth->execute( @values ) or die #stuff;
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Cleanup time
by maderman (Beadle) on Nov 08, 2001 at 10:49 UTC |