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

Matt S Trout dbix-class at trout.me.uk
Sat Feb 23 18:24:20 GMT 2008


On Thu, Feb 21, 2008 at 02:37:07AM -0300, Jose Fonseca wrote:
> Hi, sorry for the late reply, been out of the office.
> 
> >> DBIx::Class works around Apache::DBI being stupid and does a better job
> of it.
> 
> We're using Apache::DBI extensively in production with DBIx::Class so to us
> it's a real danger if it breaks down. Where, in your experience, was
> Apache::DBI causing trouble?

Because it mangles the DBI internals to override how you connect to the DB
- so it can in certain cases hand DBIC a dbh we know is dead straight back,
thus hanging the process entirely.

Since DBIC persists its $dbh internally anyway, you gain absolutely no
advantage from having Apache::DBI loaded provided you share the
$schema/$storage object.

> >> Why might I ask? Not doubting you - it just helps to have someone else
> check your logic.
> 
> "Why" which part ;) ?!
> 
> If why... "I really need that object in Apache's session memory"
> For speed only and lifting some weight off of the database backend. After I
> sent that email I rethought about it and gave up speed for reliability...it
> reloads the user object with each request..... I couldn't find the time to
> hack the session/freeze/thaw issue until it worked....
>
> Or if why "I am having this problem to start with": here's how I built it,
> nothing exceptional : When the user logs in, the app used to store him into
> $udat{customer} under Embperl. As you know $udat is the Embperl session hash
> and is normally tie'd to a session handling module(Apache::SessionX here).
> 
> And the rest is known here from my previous posts,
> $udat{customer}->{_source_handle}->{schema} is undef when thaw'ed(more
> precisely when freeze'd)....

Yes. So you just do $obj->result_source($schema->source(ref $obj)) there
to add it back.

I don't see why that's any more work than a reload ... :)

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