bigpresh / Dancer-Plugin-Database

Dancer::Plugin::Database - easy database support for Dancer applications
http://search.cpan.org/dist/Dancer-Plugin-Database
37 stars 36 forks source link

Added hook for before database connections #98

Open akalinux opened 6 years ago

akalinux commented 6 years ago

Happy Holidays!

This pull is intended to resolve rt.cpan.org ticket: 127745. I didn't look through all the readme files originally or I would have just done a git pull request originally.

Also after testing in my local cpan repo I found versons x.xxc didn't progress the version properly in the cpan client, so I have adjusted the version number in the fork.

Sorry for the extra leg work, if you started updating the code all ready.

Original ticket notes here:

Hello,

My name is Michael Shipper Cpan user is "akalinux". Happy holidays and thank you for the wonderful Perl code you have contributed over the years!

I have a use case ( mostly dealing with oracle ) where I need to have my process run code prior to the connection. My apologies for listing this as a bug, I didn't know of a way to provide a patch or enhancement through rt.cpan.org.

I would like to propose the following patchs to this module and another patch to the "Dancer2::Plugin::Database" module.

I have attached a patched version of both cpan dists to this rt.cpan.org bug.

diff Dancer-Plugin-Database-Core-0.20/lib/Dancer/Plugin/Database/Core.pm Dancer-Plugin-Database-Core-0.20c/lib/Dancer/Plugin/Database/Core.pm 13c13 < our $VERSION = '0.20';

Hide quoted text

our $VERSION = '0.20c'; 204a205 Hide quoted text $hook_exec->('database_connection_new', $settings);

diff Dancer2-Plugin-Database-2.17/lib/Dancer2/Plugin/Database.pm Dancer2-Plugin-Database-2.17c/lib/Dancer2/Plugin/Database.pm 19c19 < our $VERSION = '2.17';

Hide quoted text

our $VERSION = '2.17c'; 24c24,25 < database_error);

Hide quoted text database_error database_connection_new); 338a340,345 Hide quoted text

=item C

Called when a new database connection is about to be created. Receives a hashref of connection settings as a parameter, containing the settings the plugin will be using to connect (as obtained from the config file).

akalinux commented 5 years ago

Any Updates? The changes are pretty simple?

akalinux commented 5 years ago

Following up? Any word on if this will be merged in?