[Catalyst] Per request DBIX Class Schema Connections

Moritz Onken onken at houseofdesign.de
Mon Oct 5 11:57:24 GMT 2009


Am 05.10.2009 um 08:35 schrieb Chris Grafham:

>
> Thanks for the suggestion, however I am limited to using a pure  
> DBIx::Class solution in the production environment.
>
> I have an existing setup that is kind of working, but not always  
> (FETCH's failing on prepared statements).  The setup is as follows:
>
> 1.  Determine write master or read slave connection based on URL.
> 2.  Set connect_info on DBIx catalyst model.
> 3.  Do queries.
> 4.  Disconnect from DBI storage handle.
>
> Will this result in clean connections and disconnects at the start  
> and end of the request? Or will catalyst cache connections or not  
> reset the schema object correctly for a new connection, especially  
> then switching between the master and slave  (note: I am not using  
> DBI::Apache).  Do I need to do an explicit re-connect to the schema  
> for each connection?

Did you have a look at DBIx::Class::Storage::DBI::Replicated? It has  
some features that allow you to force the communication to the master  
server. Just have a look at the pod.

moritz



More information about the Catalyst mailing list