Re: Thread safety for DBD::File and DBD::DBM's inheritance

"H.Merijn Brand" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Thu, 15 Apr 2010 12:55:02 +0100, Tim Bunce <[email protected]>
wrote:

> On Mon, Apr 12, 2010 at 12:55:28PM +0200, Jens Rehsack wrote:
> > 
> > So I did last days when I played around with threads and
> > Log::Log4perl::Appender::DBI. I've seen, than (even if in my simply
> > example everything works fine), a cloned DBD::File still uses the same
> > file handles for reading/writing.
> > I talked with Merijn about this situation in #dbi on irc.perl.org and
> > we decided, that it would be better, to croak an error when a $dbh is
> > used in another thread than the owning one.
> > 
> > So I started with some hacking this morning to implement that and did
> 
> How? Via a CLONE method?
> 
> > 'make test' on DBI (as teached by Merijn).
> > I got errors from DBD::DBM and after a short analyze I've seen, that
> > it derives from DBD::File, but doesn't inherit the entire behavior,
> > just a subset.
> > This caused DBD::DBM::db::prepare to fail in my tests.
> > 
> > Now I'm unsure how to step forward. I can hack DBD::File to handle
> > those incomplete inheritance by ignoring them, or I can fix DBD::DBM
> > to full inherit and modify the behavior it needs to change (instead of
> > ignoring parent's methods).
> > I would prefer the second way, because I think it's the cleaner one.
> 
> It sounds good (but you've not really given enough background information
> for someone who's forgotten all he ever knew about DBD::File & DBD::DBM,
> like me).

I think DBD::DBM never got the Care Love and Attention it might have
deserved. It has great `flaws' in it, and I should have a look at how
DBD::CSV "fixed" those. There I mean me *AND* my pre-maint's, as when I
took over DBD::CSV already was in a mighty better condition than
DBD::DBM is now.

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.