Dancer::Plugin::Database socket:?
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? Thanks
On Tue, 22 Jan 2013 06:51:15 -0500 Sam Batschelet <sbatschelet@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@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
On Jan 22, 2013, at 7:22 AM, David Precious wrote:
On Tue, 22 Jan 2013 06:51:15 -0500 Sam Batschelet <sbatschelet@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.
Yes that is great and solves my problem thank you.
participants (2)
-
David Precious -
Sam Batschelet