Skip Menu |

This queue is for tickets about the DBIx-DBSchema CPAN distribution.

Report information
The Basics
Id: 16715
Status: resolved
Priority: 0/
Queue: DBIx-DBSchema

People
Owner: Nobody in particular
Requestors: ralf [...] beetlecraft.net
Cc:
AdminCc:

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



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 ); }
fixed in CVS, will be in 0.33, thanks! On Fri Dec 23 19:43:35 2005, guest wrote: Show quoted text
> 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 Show quoted text
> handle > supplied. This is not always the case. Choosing the DBI
recommendation Show quoted text
> 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 Show quoted text
> time as perl recommendation in the DBI module. > > Hope this helps.