From: Andrew Pimlott [mailto:[EMAIL PROTECTED] > On Mon, Feb 16, 2004 at 03:46:28PM -0600, Jay Hannah wrote: > > I would *love* to set another flag/whatever so DBI would bark at us > > whenever $dbh's were garbage collected. > > Can I ask exactly what you are worried about? ... > Or am I missing some common usage pattern?
You're right. I shouldn't need the warning, especially when it's wrong. Even so, it has been useful to me on many occasions in dialogues like this: Programmer X: Why am I getting this "Issuing rollback() for database handle..." error? Me: Because you're not issuing an explicit $dbh->disconnect when you're done with your database handler. X: Oh. Me: Ya, you need to do that. Let's look at your code... Ok, let's also talk about (1) $sth->finish'ing some of these statements, (2) controlling the scope of your $sth's and $dbh's, (3) using placeholders instead of frequent prepares of similar SQL, (4) avoiding redundant $dbh's at all costs (connect is expensive), (5) tighter management of $dbh's / $sth's when running nested transactions... I guess I'm just used to the warning and have been using it as a flag for years that somebody isn't coding as cleanly as they should be. I suppose I'll miss it for the wrong reasons. -sniff- > So while I agree the warning could be helpful, I am skeptical that it > does enough good to warrant keeping it. I guess it cold be an option, > though. I'm starting to come to grips with it's demise. > Incidentally, you already don't get the warning during global > destruction, so it isn't that reliable. I ran a little test against all our productions RDBMSs. As luck would have it, it seems that it is being thrown in global destruction in the 2 DBD's I use the most. I didn't realize until now that it's not being thrown in the others. DBD::Informix -> Informix 9.3: Issuing rollback() for database... DBD::Informix -> Informix SE (ancient): No warning DBD::Sybase -> freetds -> MS-SQL server: Issuing rollback() for database... DBD::Proxy -> DBD::Oracle -> Oracle (v?): No warning DBD::Oracle -> Oracle (v?): No warning DBD::mysql: No warning Thanks for the consideration. I'll get back on my meds now and start pre-emptive training rather than reactional code review. -grin- j perl -MDBI -e 'DBI->installed_versions' Perl : 5.008002 (i686-linux) OS : linux (2.4.18-17.7.x) DBI : 1.39 DBD::mysql : 2.9003 DBD::Sybase : 1.02 DBD::Sponge : 11.09 DBD::Proxy : 0.2004 DBD::Informix : 2003.04 DBD::File : 0.2001 DBD::ExampleP : 11.11 DBD::CSV : 0.2002