[Catalyst] Per request DBIX Class Schema Connections

Chris Grafham cgrafham at yahoo.co.uk
Mon Oct 5 06:35:29 GMT 2009


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 f=
ailing on prepared statements). =A0The setup is as follows:
1. =A0Determine write master or read slave connection based on URL.2. =A0Se=
t connect_info on DBIx catalyst model.3. =A0Do queries.4. =A0Disconnect fro=
m 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 th=
e master and slave =A0(note: I am not using DBI::Apache). =A0Do I need to d=
o an explicit re-connect to the schema for each connection?

--- On Sun, 4/10/09, Scott McWhirter <scott+catalyst at konobi.co.uk> wrote:

From: Scott McWhirter <scott+catalyst at konobi.co.uk>
Subject: Re: [Catalyst] Per request DBIX Class Schema Connections
To: "The elegant MVC web framework" <catalyst at lists.scsys.co.uk>
Date: Sunday, 4 October, 2009, 2:23 PM

Another option is to handle this at the db layer using something like sqlre=
lay. I haven't used it personally but have heard some good thing about it f=
rom others. You can set it up to filter queries between different sets of d=
atabase hosts:

http://sqlrelay.sourceforge.net/sqlrelay/router.html


--=A0
-Scott McWhirter- | -Technology Consultant-

[ Cloudtone Studios - http://www.cloudtone.ca ]=A0

On Sun, Oct 4, 2009 at 04:19, Chris Grafham <cgrafham at yahoo.co.uk> wrote:




Im looking for some advice for best practice for the following situation -


1. =A0HTTP Request arrives.
2. =A0Determine if a database connection is required for either a MySQL rea=
d-only slave or write master (via a piece of custom code based on request U=
RL).

3. =A0Connect to chosen database ($schema->connect).
4. Disconnect at end of request (no persistent db connections).

Thanks in advance.





      =

_______________________________________________

List: Catalyst at lists.scsys.co.uk

Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst

Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/

Dev site: http://dev.catalyst.perl.org/







-----Inline Attachment Follows-----

_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



      =

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20091005/27bc2=
733/attachment.htm


More information about the Catalyst mailing list