[dancer-users] Dancer::Plugin::Database socket:?

David Precious davidp at preshweb.co.uk
Tue Jan 22 12:22:02 GMT 2013


On Tue, 22 Jan 2013 06:51:15 -0500
Sam Batschelet <sbatschelet at mac.com> wrote:

> Hello I have a development environment which creates individual
> instances of mysql for each development "camp".  To connect to these
> instances I declare typical connection information but I don't see
> how to set the option to set non standard socket location
> 'mysql_socket' for the plugin.  Is there a trick for this, future
> support?

You can craft your own DSN and provide it as the DSN parameter, for
instance:

plugins:
  Database:
    foo:
      dsn: "DBI:mysql:database=dbname;mysql_socket=/var/run/mysql-foo"
    bar:
      dsn: "DBI:mysql:database=dbname;mysql_socket=/var/run/mysql-bar"

That should work, I believe.

I could add support for setting a param named mysql_socket instead of
providing host and port in a future version, so you'd be able to say
e.g.:

plugins:
  Database:
    foo:
      database: 'dbname'
      mysql_socket: '/var/run/mysql-foo.sock'

That might be a little cleaner.

The custom DSN way will work now, though.


-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github




More information about the dancer-users mailing list