Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

dsn_extra configuration hash for "all remaining" dsn key-val pairs #38

Closed
wants to merge 1 commit into from

3 participants

@msouth

This just adds a 'dsn_extra' hash to the config that you can use
for things like mysql_socket or any other current/future driver-
specific parameter that you might need for your data source name.

@msouth msouth dsn_extra configuration hash for "all remaining" dsn key-val pairs
This just adds a 'dsn_extra' hash to the config that you can use
for things like mysql_socket or any other current/future driver-
specific parameter that you might need for your data source name.
92d1c0e
@bigpresh
Owner

Wow - this has been waiting far too long, sorry.

Will get this merged as soon as I have a moment to resolve the conflict.

@ambs
Collaborator

Merged manually. Releasing ::Core and ::Dancer1 versions. Dancer2:: should need to wait some extra fixes. Thanks.

@ambs ambs closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2013
  1. @msouth

    dsn_extra configuration hash for "all remaining" dsn key-val pairs

    msouth authored
    This just adds a 'dsn_extra' hash to the config that you can use
    for things like mysql_socket or any other current/future driver-
    specific parameter that you might need for your data source name.
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/Dancer/Plugin/Database.pm
View
14 lib/Dancer/Plugin/Database.pm
@@ -168,6 +168,11 @@ sub _get_connection {
push @extra_args, $_ . "=" . $settings->{$_};
}
}
+ if (my $even_more_dsn_args = $settings->{dsn_extra}) {
+ foreach my $arg ( keys %$even_more_dsn_args ) {
+ push @extra_args, $arg . '=' . $even_more_dsn_args->{$arg};
+ }
+ }
$dsn .= ':' . join(';', @extra_args) if @extra_args;
}
@@ -462,6 +467,15 @@ database, e.g.:
host: localhost
sid: ABC12
+If you have any further connection parameters that need to be appended to the
+dsn, you can put them in as a hash called dsn_extra. For example, if you're running
+mysql on a non-standard socket, you could have
+ plugins:
+ Database:
+ driver: mysql
+ host: localhost
+ dsn_extra:
+ mysql_socket: /tmp/mysql_staging.sock
=head2 DEFINING MULTIPLE CONNECTIONS
Something went wrong with that request. Please try again.