Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to replace DBI with a module which subclasses DBI #26

Open
mjegh opened this issue Feb 23, 2012 · 1 comment
Open

Ability to replace DBI with a module which subclasses DBI #26

mjegh opened this issue Feb 23, 2012 · 1 comment
Labels

Comments

@mjegh
Copy link

mjegh commented Feb 23, 2012

I'd really like to Dancer::Plugin::Database to call DBIx::Log4perl->connect instead of DBI->connect. DBIx::Log4perl subclasses DBI so it should be fairly straight forward if D::P::D had a config option for it.

@bigpresh
Copy link
Owner

This seemed dead easy to start with - a new optional param, dbi_class or something, and have the connection code use $class->connect instead of DBI->connect.

However, where it gets interesting is that the DB handle is then re-blessed into Dancer::Plugin::Database::Handle which subclasses DBI::db. For this to work, the code would presumably need to call $class->connect, then see what kind of object it got back (DBI::db, DBIx::Log4perl::db, ...) then arrange for the D::P::D::Handle to subclass that type of object at runtime. That could make things more complex.

I shall have a further think on this as soon as I have a moment - suggestions welcome of course :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants