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]
