Thanks all for the input--I can't believe how much and how useful it was. I have started making a separate module with simple methods for performing queries that I will use often. I have a couple of larger objects stored in normalized tables, so I will probably try these as objects with methods to access the various pieces. I had thought about Class::DBI, but the overhead bothers me a bit as does the need to describe the table structure (which I am trying to get away from a bit, as it seems to be changing often).
Sean ----- Original Message ----- From: "William McKee" <[EMAIL PROTECTED]> To: "Sean Davis" <[EMAIL PROTECTED]> Cc: "cgiapp" <[EMAIL PROTECTED]> Sent: Thursday, September 30, 2004 4:00 PM Subject: Re: [cgiapp] Separate database module? > On Thu, Sep 30, 2004 at 03:52:45PM -0400, Sean Davis 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. > > Class::DBI has been a lifeline for me in this kind of situation. All of > my SQL is kept in a single file (or can be broken up into a set of > modules if you prefer). Although it makes it unnecessary to write SQL > for many common procedures, it can easily handle custom SQL when you > have joins or want to do some performance tweaking. I know some other > folks here are using it and could offer some other views. There is a > wiki[1] with a tutorial and some useful recipes for getting started. > > Good luck, > William > > [1] http://www.class-dbi.com/cgi-bin/wiki/index.cgi > > -- > Knowmad Services Inc. > http://www.knowmad.com > --------------------------------------------------------------------- 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]
