A few years ago, when I didn't know any better, I actually did something similar to what you're suggesting.
But I did it with the dreaded 'require'
I haven't done it since, as my skills have developed a tad since then, but it might just be a bad idea that works in your case.
What I did was this:
1.) Created a file called: queries.pl
In this file, I put things like:
and then, in my script: parse_notes.pl, I used:$Q_FINDMAX = 'select max(note_id) from pat_notes'; $Q_FINDMIN = 'select min(note_id) from pat_notes'; . . etc...
After that, it's just a matter of using the $Q_ variable names to refer to the queries.require ('/prod/parse/queries.pl');
The advantage of doing it this way is that it allowed the SQL folks to update/tune SQL without having to go into the actual Perl script to find them.
It's probably not the *best* way to do this sort of thing, but maybe it's good enough for what you're after? The syntax might be a little off (like I said, I haven't done this in a while, and I don't have any examples in front of me to refer to
Trek
In reply to Re: Abstracting SQL without Stored Procedures
by TrekNoid
in thread Abstracting SQL without Stored Procedures
by radiantmatrix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |