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

Re^2: Simplifying queries in DBI

by neilwatson (Curate)
on Mar 15, 2014 at 15:37 UTC ( #1078450=note: print w/ replies, xml ) Need Help??


in reply to Re: Simplifying queries in DBI
in thread Simplifying queries in DBI

I was hoping to use place holders, but I don't see any way for the place holders to also contain the text beyond the values. At best I can run a loop to build the string for all the LIKE bits, but it doesn't seem to offer a good gain.

Example:

if ( $query{hostname} ) { $query = $query . " AND host_name LIKE '$query{hostname}' ESCAPE +'!'"; } if ( $query{ip_address} ) { $query = $query . " AND ip_address LIKE '$query{ip_address}' ESCA +PE '!'"; } # etc...

Neil Watson
watson-wilson.ca


Comment on Re^2: Simplifying queries in DBI
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2014-09-30 20:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (384 votes), past polls