Think about Loose Coupling | |
PerlMonks |
Re: SQL::Abstract with non SQL source databy roboticus (Chancellor) |
on Mar 10, 2011 at 11:57 UTC ( [id://892391]=note: print w/replies, xml ) | Need Help?? |
First, you need to figure out what you would convert each case of your criteria to, and then figure out what the common elements are. I'm going to assume a simple text field. So the first one is pretty simple, you want to convert FOO to column_name = 'FOO'. The second one is also pretty simple, you can convert it to:
or you could use:
For the third case, you'd want to convert it to something like:
To make things simpler, we should wrap all of our clauses in parenthesis, so we don't have to add code to figure out when we need them or not. You need them in some cases to allow different clauses to interact properly, as we wouldn't want an adjacent search clause to interact with part of this one. So to code it up, I'd suggest something like:
Now there are a few details you'll want to take care of, like ensuring the fields are properly quoted, etc., but this is how I'd approach the problem. Let me know if you need any further details or explanations. ...roboticus When your only tool is a hammer, all problems look like your thumb. Update:
In Section
Seekers of Perl Wisdom
|
|