benvanstaveren / Mojolicious-Plugin-Database

"proper" handling of DBI based connections in Mojolicious
http://search.cpan.org/dist/Mojolicious-Plugin-Database/
9 stars 3 forks source link

on_connect support #8

Closed stigtsp closed 9 years ago

stigtsp commented 9 years ago

Hi, added on_connect support to this module. Useful for setting variables in the db connection etc.

benvanstaveren commented 9 years ago

Cool, I'm traveling at the moment but will merge this and do a release soon On Sep 25, 2015 12:17 PM, "Stig" notifications@github.com wrote:


You can view, comment on, or merge this pull request online at:

https://github.com/benvanstaveren/Mojolicious-Plugin-Database/pull/8 Commit Summary

  • Added on_connect option to plugin to allow setting variables and such immediately after connection.
  • Added on_connect to multi and it's test

File Changes

Patch Links:

- https://github.com/benvanstaveren/Mojolicious-Plugin-Database/pull/8.patch

https://github.com/benvanstaveren/Mojolicious-Plugin-Database/pull/8.diff

— Reply to this email directly or view it on GitHub https://github.com/benvanstaveren/Mojolicious-Plugin-Database/pull/8.

stigtsp commented 9 years ago

On second thoughts, this is actually not a good patch. This feature should be handled by 'Connected' to properly handle auto-connect etc.

I'd recommend reverting my patch.

http://search.cpan.org/~timb/DBI-1.634/DBI.pm#Callbacks

benvanstaveren commented 9 years ago

I'm still on the fence about it really, the DBI callbacks seem to be a bit of a sledgehammer type thing, I'll ponder it some more :)