I looked at your code, and yes, I want to suggest a different way, to organize them.
Generally speaking, I don't like to mix data with code. In your case, I would look at your sql statements as data, when I take your Perl scripts as code.
But I don't agree with your boss, if you understood his idea correctly, that you have to put each(?) of those statements into one(?) script. That would become a even bigger mess. After one month, probably nobody, even yourself can quickly figure out which script is for which sql statement any more.
I would suggest you to have a separate package, which you can call it SQLBuilder. If you want to impress your boss more, do it in OO-style.
The main function of this package is to build sql statement as instructed by you, and return the sql statement as a string. You should contain all the syntax details in this package, do it once forever.
Another benefit of this approach is that, it makes your code more portable. What I realized in the past is that, the sql syntax is actually slightly different from database to database, as they all support some sort of their own extension. If you want to port your script to a different database one day in the future, the sql syntax changes will be contained in this package, instead of spreaded everywhere.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.