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

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]
vrk takes a cookie from the platter on the sideboard.
Eily thinks vrk is a cookie monster
talexb thinks the term 'cookie monster' is unnecessarily drogatory ;) and takes a cookie as well. Mmmm. Delicious cookies.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2017-04-25 15:53 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (458 votes). Check out past polls.