I've gotta agree with the stored procedure/view solution, despite the fact that I despise it in practice (since it when I've seen it suggestied, it's to pull the power away from the developers and hands it to the DBA), but it does have genuine speed benefits and keeps all the SQL out of your code.

I know that Basset's persistent object can map multiple tables into a single object, and I think it does it pretty well and efficiently. But, as I've said in another thread, I'm biased (being the author and all). It's heavily supported, but not widely used, so you may find it difficult to work with. If so, I'd love to hear about it. Suggestions very welcome.

Simple SQL::Abstract might be useful, too. Instead of having sql statements all over the place, you'd be using it to construct queries for you. You end up with the same stuff, but it's much easier to abstract out the table or column names to central locations. Yeah, yeah, you can do it with plain old statements, but it'd probably be a bit cleaner by using SQL::Abstract with a few custom brewed containers around it.


In reply to Re: What's the best module to stop mixing SQL with Perl? by jimt
in thread What's the best module to stop mixing SQL with Perl? by Withigo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.