Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Simplifying queries in DBI

by graff (Chancellor)
on Mar 15, 2014 at 16:56 UTC ( #1078468=note: print w/replies, xml ) Need Help??

in reply to Simplifying queries in DBI

Another variation on my previous reply that might be relevant: I have a web app with a search page for probing a set of related tables, where the user can fill in search terms - it's a bilingual dictionary system, so search conditions can include things like headword spelling, pronunciation, part-of-speech, translated meaning, etc, in arbitrary combinations.

When the search form is submitted, the app loops over the fields that have been filled in by the user, and assembles two parallel arrays: "@where_clauses" and "@where_values". The first array is used to build the SQL statement (table names and join conditions are added as needed), and the second array is passed to the execute call for that statement. This way, the ordering of fields and placeholder values is assured.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078468]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2018-05-26 01:32 GMT
Find Nodes?
    Voting Booth?