Skip Menu |

This queue is for tickets about the Class-DBI-Loader CPAN distribution.

Report information
The Basics
Id: 13689
Status: open
Priority: 0/
Queue: Class-DBI-Loader

Owner: Nobody in particular
Requestors: jmanning [...]

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

Subject: mysql DSN hostname syntax not supported
Download (untitled) / with headers
text/plain 641b
Class::DBI::Loader-0.22, perl v5.8.6 and perl v5.8.0. Linux 2.4 and 2.6 When starting Loader with a dsn="", I get the following errors: Couldn't load tables "DBD::mysql::st execute failed: You have an error in your SQL syntax near ' LIKE 'Environment'' at line 1 [for Statement "SHOW TABLE STATUS FROM LIKE 'Environment'"] Clearly dbname is not correctly parsed out of the DSN - the error must be in _relationships at "$dsn =~ m/\Adbi:\w+(?:\(.*?\))?:(.+)\z/i" Perhaps adding an optional hostname to the regexp would work: "$dsn =~ m/\Adbi:\w+(?:\(.*?\))?:(.+)(?:\:.*?)\z/i"
From: jmanning
Download (untitled) / with headers
text/plain 471b
(Addendum) From mysql docs: $dbh = DBI->connect("DBI:mysql:$database", $user, $password); $dbh = DBI->connect("DBI:mysql:$database:$hostname", $user, $password); $dbh = DBI->connect("DBI:mysql:$database:$hostname:$port", $user, $password); So, perhaps these variants should all be supported. Just replacing '\z' with '\:?' from the original regex would work, or adding an explicit port field just like hostname was added above.
From: Raphael Kraus
Download (untitled) / with headers
text/plain 207b
Actually, replacing line 46: $dsn =~ m/\Adbi:\w+(?:\(.*?\))?:(.+)\z/i with: $dsn =~ /^dbi:\w+:(\w+):/i works well. (I didn't find that the other suggested replacement worked.) Thanks! Raphael
text/x-diff 94b
46c46 < $dsn =~ /^dbi:\w+:(\w+):/i --- > $dsn =~ m/\Adbi:\w+(?:\(.*?\))?:(.+)\z/i
From: Raphael Kraus
Download (untitled) / with headers
text/plain 290b
Erps - make that... On line 46 replace: $dsn =~ m/\Adbi:\w+(?:\(.*?\))?:(.+)\z/i With: $dsn =~ /^dbi:\w+:([\w=]+)/i (I realised that this wouldn't work if the user said db=database_name and the trailing : is redundant) Other alternative could be (or similar): $dsn =~ /^dbi:.*?:(.*?):/
46c46 < $dsn =~ m/\Adbi:\w+(?:\(.*?\))?:(.+)\z/i --- > $dsn =~ /^dbi:\w+:([\w=]+)/i

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to