Subject: | case mismatch in DBIx::DBSchema::DBD::mysql.pm |
perl 5.8.4
mysqladmin Ver 8.40 Distrib 4.0.24, for pc-linux-gnu on i386
Linux mybox 2.6.8-2-686
The module is dependant on FetchHashKeyName => 'Name' on the database handle
supplied. This is not always the case. Choosing the DBI recommendation of 'NAME_lc' does break all the hash key addressing as 'Type' is now 'type', etc. I have wrapped the fetchrow_hashref method calls so that this doesn't matter at the moment (see patch). However, more robust would be to force FetchHashKeyName => 'NAME_lc' all the time as perl recommendation in the DBI module.
Hope this helps.
--- /usr/local/share/perl/5.8.4/DBIx/DBSchema/DBD/mysql.pm 2005-04-15 14:15:34.000000000 +0100
+++ /usr/local/share/perl/5.8.4/DBIx/DBSchema/DBD/mysqlorig.pm 2005-12-24 00:08:43.312577696 +0000
@@ -34,11 +34,13 @@
sub columns {
my($proto, $dbh, $table ) = @_;
+ my $oldkhv=$dbh->{FetchHashKeyName};
+ $dbh->{FetchHashKeyName}="NAME";
my $sth = $dbh->prepare("SHOW COLUMNS FROM $table") or die $dbh->errstr;
$sth->execute or die $sth->errstr;
- map {
+ my @r=map {
$_->{'Type'} =~ /^(\w+)\(?(.+)?\)?( unsigned)?$/
or die "Illegal type: ". $_->{'Type'}. "\n";
my($type, $length) = ($1, $2);
[
$_->{'Field'},
@@ -49,6 +51,8 @@
$_->{'Extra'}
]
} @{ $sth->fetchall_arrayref( {} ) };
+ $dbh->{FetchHashKeyName}=$oldkhv;
+ @r;
}
#sub primary_key {
@@ -83,6 +87,8 @@
sub _show_index {
my($proto, $dbh, $table ) = @_;
+ my $oldkhv=$dbh->{FetchHashKeyName};
+ $dbh->{FetchHashKeyName}="NAME";
my $sth = $dbh->prepare("SHOW INDEX FROM $table")
or die $dbh->errstr;
$sth->execute or die $sth->errstr;
@@ -98,6 +104,7 @@
push @{ $unique{ $row->{'Key_name'} } }, $row->{'Column_name'};
}
}
+ $dbh->{FetchHashKeyName}=$oldkhv;
( $pkey, \%unique, \%index );
}