I have an old app that uses DBI directly with Postgresql. I want to add in support for DBIx::Class into the same app. I don't want to double the number of database connections so would like to replace the method that returns a $dbh in the old app with:
On Mon, Sep 28, 2015 at 2:45 AM, Will Crawford <[hidden email]> wrote:
I'd create some sort of proxy object that stores a ref to $schema and does the ->dbh_do magic behind the scenes whenever you call a method on it ...
Frankly, I'm afraid to touch the legacy code much. The legacy code has its own DBI subclass that holds real DBI $dbh handles for master and slaves database servers and tracks master or slave in a global. Transactions are started automatically and the app code where a commit is called could be even in a different module than where the transaction was started. Nasty stuff.