Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dancer-Plugin-Database CPAN distribution.

Report information
The Basics
Id: 61089
Status: resolved
Priority: 0/
Queue: Dancer-Plugin-Database

People
Owner: Nobody in particular
Requestors: steve [...] blighty.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bad dsn generation in Dancer::Plugin::Database
Date: Sun, 5 Sep 2010 12:41:10 -0700
To: bug-dancer-plugin-database [...] rt.cpan.org
From: Steve Atkins <steve [...] blighty.com>
Version 0.06 A configuration entry such as this... plugins: Database: driver: 'Pg' database: 'keydancer' host: 'localhost' ... will create this dsn: "dbi:Pg:database=keydancer:host=localhost". It should create "dbi:Pg:dbname=keydancer;host=localhost". There are two apparent bugs in _get_connection() - it's using colons to separate parameters instead of semicolons, and it's using "database" to set the database name rather than "dbname". Cheers, Steve
On Sun Sep 05 15:41:19 2010, steve@blighty.com wrote: Show quoted text
> Version 0.06 > > A configuration entry such as this... > > plugins: > Database: > driver: 'Pg' > database: 'keydancer' > host: 'localhost' > > ... will create this dsn: "dbi:Pg:database=keydancer:host=localhost". > > It should create "dbi:Pg:dbname=keydancer;host=localhost".
Well, according to the DBI documentation: It is recommended that drivers support the ODBC style, shown in the last example above. It is also recommended that that they support the three common names 'host', 'port', and 'database' (plus 'db' as an alias for database). This simplifies automatic construction of basic DSNs: "dbi:$driver:database=$db;host=$host;port=$port". Drivers should aim to 'do something reasonable' when given a DSN in this form So, using 'database' rather than dbname is in general correct; looking at DBD::Pg's code, it will support that (even though it does not appear to be documented): ## Allow "db" and "database" as synonyms for "dbname" $dbname =~ s/\b(?:db|database)\s*=/dbname=/; You're correct that _get_connection() should should use semicolons instead of colons to separate parameters though; colons should be used only for the initial "dbi:$driver:" part; any remaining param=value pairs should indeed be separated with semi-colons. Thanks for catching that - I'll get a new version released soon! I'll close this ticket as soon as the new version is released. Cheers Dave P
On Mon Sep 06 07:27:13 2010, BIGPRESH wrote: Show quoted text
> You're correct that _get_connection() should should use semicolons > instead of colons to separate parameters though; colons should be used > only for the initial "dbi:$driver:" part; any remaining param=value > pairs should indeed be separated with semi-colons. > > Thanks for catching that - I'll get a new version released soon! > > I'll close this ticket as soon as the new version is released.
Version 0.07, which contains this bugfix, is on its way out to CPAN now. Thanks again for the report.