Sean,
I'm a big fan of Class::DBI. It's made the simple things dead easy,
and easier to do the more complicated ones. CDBI is a object wrapper,
where you define a class for each row in the database. You can define
relationships between tables (has_a, has_many, etc) with a single line
of code and it's equally easy to get at the related row/object. There
can be a bit of a learning curve, but IMHO it's well worth it. There
is an active community and frequent releases. Current version is 0.96.
http://search.cpan.org/~tmtm/Class-DBI-0.96/

I'm not sure what sort of queries you're doing in your code, but
searches are pretty easy out of the box:

my @results = My::Class->search(foo=>123, bar=>456);

This says, give me all the rows where column "foo" has the value "123"
and column "bar" has the value "456". If you have other common queries
you can define them once in your module and call them as needed later
in the code.

I've probably done a poor job of explaining all that CDBI can do, but
you should definitely take a look at it. Very powerful stuff.

Drew

On Thu, 30 Sep 2004 15:52:45 -0400, Sean Davis <[EMAIL PROTECTED]> wrote:
> I am building a cgi::application that queries pretty extensively (at
> least for me) from a MySQL database.  I am having trouble with
> maintainability, as the SQL code is mixed into the perl code and,
> unfortunately, we are changing the database schema fairly often right
> now.  I was wondering what hints folks have about managing the SQL
> parts away from the logic of the code.  For my limited programming
> skills, writing subroutines within my CGI::App is easiest but probably
> not the most flexible.
> 
> Thanks,
> Sean
-- 
----------------------------------------------------------------
 Drew Taylor                 *  Web development & consulting
 Email: [EMAIL PROTECTED]  *  Site implementation & hosting
 Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
 ----------------------------------------------------------------

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to