Afternoon chaps,

I'm currently building a medium scale web application and as much as possible I'm trying to keep everything as discrete objects for obvious reasons. However I'm having some difficulty with the SQL module.

I've written an SQL object that contains SQL with placeholders as class data with a single method (extract) to pull this data out for preparing when neccessary. This is working fine for most cases; however sometimes I have to build dynamic SQL that is formed from user input (checkboxes selected etc). In this case I can't use placeholders because I'm not supplying data to be queried but data definition statements that will be queried apon.

At the moment I've ended up with some hellish SQL hardcoded in some places with loads of conditional statements. Is there a better way of doing this? I've had a peek on CPAN but nothing really fits - DBIx::Abstract seems the closest. Any suggestions monks?

Ta.


In reply to SQL parser from fragments by snapdragon

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.