On Oct 6, 2004, at 10:31 AM, William McKee wrote:
On Tue, Oct 05, 2004 at 10:56:14PM -0400, [EMAIL PROTECTED] wrote:Do you use Class::DBI to manage the database integration?
Actually, I'm so often working on many tables at once that I write the
SQL myself (with help from my DBA... :-) and go for straight DBI. Often
I'm having to use temporary tables and/or multiple joings to get at my
data, so Class::DBI won't work. (The joy and bane of relational dbs is
the relational element.)
At the cost of starting to sound like a Class::DBI evangelist, I think
it's important to point out for those considering CDBI that using custom
SQL does not necessary mean CDBI is ineffective. For me, one of the
biggest sellers of the module was that all of my SQL statements could be
stored in one place.
In fact, it's not even necessary to return CDBI objects; you could have
your code return an array. I have a function called sql_hash which
returns a list of hashes. I used to use this function for my select
statements before switching to CDBI. It occasionally comes in handy when
I have a complex join which I don't want to map to objects.
OK, I'll be quiet now.
William
-- 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]
I think I am heading the way of William. I am finding that I can use CDBI for the vast majority of the little tedious stuff. However, I also use methods to step outside that framework to handle (less gracefully) constructing arbitrarily complex SQL queries that I code by hand (learned SQL before perl, believe it or not). I have been looking at SQL::Abstract combined with already defined CDBI classes to automate this process somewhat (why toss all this valuable information). Straight DBI already includes mapping to many convenient forms for returned rows, so one can use them as is.
Sean
--------------------------------------------------------------------- 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]
