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

Martin Evans <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Organization Easysoft Limited
Message-ID <[email protected]>
Jens Rehsack wrote:
> Hi DBI Developers,
> 
> as maintainer of SQL::Statement I try often some easy examples using
> DBD::CSV, because I have a good knowledge what happens behind the
> scenes.
> 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
> '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.
> 
> Anyone against it?
> 
> Best regards,
> Jens
> 
> 

The second of your suggestions sounds better to me but this is not an
area I am too familiar with. I am familiar with some of your work though
and imagine your offer is not one that should be shrugged off without
good reason.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com
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.