CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: DBI:
SQL query wrappers



Feb 28, 2002, 1:01 AM

Post #1 of 2 (8019 views)
SQL query wrappers Can't Post

Anyone tried making an SQL wrapper, so you can do stuff like:
[perl]my $rec = $DB->select({
cols =>[@cols],
tables =>[@tables],
cond =>{%cond},
opts =>"order by Title"

Looking through some posts on other boards, there seems to be mixed opinions on this. Some say it's easier to just write out queries in long hand. Others think it's much cleaner looking and easier to make a module to automate the creation of queries at the expense of posibly limiting the complexity of the type of queries you can do.

I started writing one knowing this, so I at least made a sub to let me write them in longhand when needed. So far for boolean queries, I can do global AND and OR searches, and ORs on individual keys where an array of values is passed instead of a scalar. Also made it so the condition can be a scalar or array so I could prewrite the conditions to add some flexibility.

What do you think? Is this worthwhile or worthless? Ideas are also appeciated. Smile
FuzzyLogic at PerlMad dot com

User / Moderator

Mar 1, 2002, 5:20 AM

Post #2 of 2 (8006 views)
Re: [PerlKid] SQL query wrappers [In reply to] Can't Post

I don't think it's at all worthless, but neither is it original ... --k.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives