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

People
Owner: Nobody in particular
Requestors: jmanning [...] alisa-jon.net
Cc:
AdminCc:

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



Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.415 (Entity 5.415)
Subject: mysql DSN hostname syntax not supported
X-RT-Original-Encoding: iso-8859-1
Content-Length: 641
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="dbi:mysql:dbname:hostname.com", I get the following errors: Couldn't load tables "DBD::mysql::st execute failed: You have an error in your SQL syntax near ':hostname.com LIKE 'Environment'' at line 1 [for Statement "SHOW TABLE STATUS FROM dbname:hostname.com 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"
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.415 (Entity 5.415)
From: jmanning
X-RT-Original-Encoding: iso-8859-1
Content-Length: 471
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.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Message-Id: <rt-3.5.HEAD-13840-1140570621-494.13689-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1140570621-13840-6"
From: Raphael Kraus
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 207
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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: multipart/mixed; boundary="----------=_1140570621-13840-5"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: application/octet-stream; name="mysql.pm.patch"
Content-Disposition: inline; filename="mysql.pm.patch"
Content-Transfer-Encoding: base64
Content-Length: 94
Download mysql.pm.patch
text/x-diff 94b
46c46 < $dsn =~ /^dbi:\w+:(\w+):/i --- > $dsn =~ m/\Adbi:\w+(?:\(.*?\))?:(.+)\z/i
MIME-Version: 1.0
In-Reply-To: <rt-3.5.HEAD-13840-1140570621-494.13689-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
References: <rt-3.5.HEAD-13840-1140570621-494.13689-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.5.HEAD-13823-1140572162-1636.13689-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1140572162-13823-7"
From: Raphael Kraus
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 290
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:.*?:(.*?):/
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: multipart/mixed; boundary="----------=_1140572162-13823-6"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: text/plain; charset="utf-8"; name="mysql.pm.patch.txt"
Content-Disposition: inline; filename="mysql.pm.patch.txt"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: ascii
X-RT-Original-Encoding: utf-8
Content-Length: 96
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 Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.