Saying you're strongly against runtime SQL generation strikes me as similar to saying that you're against procedural programming... It leaves out the context of the problem that you're solving.

If you're building a script with a known number of queries, a static collection of queries may adequately address your needs, and if your queries are fairly complicated or high-volume, I can understand putting in the effort to optimize them.

However, if you're building a more open-ended system with various ad-hoc query capabilities, such as an OO-RDBMS mapper, you might find that pre-writing all of the queries one might possibly use is laborious, and properly selecting amongst them (the "only thing lacking", above) becomes an increasingly complex problem.

There must actually be a whole range of possibilities here, ranging from static, to mostly static with some dynamic subclauses, to mostly dynamic with a few static hand-optimized queries, to completely dynamic, and all sorts of other variations. Each of those techniques will be good at solving some kinds of problem, and less useful for others... And of course, the quality of the individual library's implementation, and the developer's level of comfort with the approach, are factors that are at least as important as whether the SQL is written in advance or not.

Without a discussion of the context -- what you're doing and why -- declarations of jihad against dynamic SQL (or against dynamic binding, or against Microsoft, or whatever) have a ring of hollow ideology to my ear.


In reply to Re: Eliminating Dynamic SQL Generation with Decision Matrices for Tighter Large Scale Applications by simonm
in thread Eliminating Dynamic SQL Generation with Decision Matrices for Tighter Large Scale Applications by princepawn

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.