[Dbix-class] serializing DBIx::Class::ResultSourceHandle (Followup)

Matt S Trout dbix-class at trout.me.uk
Sat Mar 8 15:46:47 GMT 2008


On Sat, Feb 23, 2008 at 10:04:31PM -0300, Jose Fonseca wrote:
> Hi, thanks for the info on Apache::DBI - I guess it's a very orthogonal
> module by design, but I just had not thought of its unwanted implications
> for DBIx::Class. Thanks for that.
> 
> Just a comment, since you brought that up: When you hand DBIC a connected
> DBH via a coderef at connect() time, it also  modifies some internals of
> that connection. I have a large app in production right now that has been
> partially migrated to DBIC, say 70% is done. But the legacy portion still
> uses the original DBH and I found that after DBIC uses that handle, some of
> the DBH instance variables had changed. While I have no problems with that
> at the moment, I think that when handed an open handle DBIC should not alter
> its configuration in any way because (IMHO)we should assume the developer
> pre-configured it as needed(why else hand it an already open handle?).
> Specifically : it brought up the raiseerror flag and DBH now dies on my
> production server when any database error happens on the legacy code.  That
> would be desirable on my test server to have it crash as soon as possible on
> error, but in production it was an unexpected collateral effect(Documented?
> I confess I did not check).

Not only documented but configurable.

And we -can't- assume the developer preconfigured it, the DBIC txn stuff
needs RaiseError so the default is to make sure the DBIC code is safe - I
know of a number of setups using a sub to return a dbh that aren't sharing
it and we would have broken them all on upgrade otherwise.

So, if you want to mess with DBIC, you have to explicitly say 'unsafe' as
a connect info attr. Then it leaves your $dbh alone, but be aware stuff may
not work right.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list