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

Tim Bunce <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
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).

Tim.
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.