From 3b9971c65158bd6eeef1d146fdef19f2a56e2954 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 28 Jun 2007 03:17:33 +0000 Subject: [PATCH] DBSchema::DBD::mysql NAME vs NAME_lc patch from Ralf Hack, closes: CPAN#16715. DBSchema::DBD::Mysql fix for additional column data from Chris Mungall, closes: CPAN#20859, thanks! --- DBSchema/DBD/mysql.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/DBSchema/DBD/mysql.pm b/DBSchema/DBD/mysql.pm index ef7bb59..924c309 100644 --- a/DBSchema/DBD/mysql.pm +++ b/DBSchema/DBD/mysql.pm @@ -34,10 +34,12 @@ This module implements a MySQL-native driver for DBIx::DBSchema. 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 { - $_->{'Type'} =~ /^(\w+)\(?([^)]+)?\)?( unsigned)?$/ + my @r = map { + $_->{'Type'} =~ /^(\w+)\(?([^)]+)?\)?( \d+)?$/ or die "Illegal type: ". $_->{'Type'}. "\n"; my($type, $length) = ($1, $2); [ @@ -49,6 +51,8 @@ sub columns { $_->{'Extra'} ] } @{ $sth->fetchall_arrayref( {} ) }; + $dbh->{FetchHashKeyName}=$oldkhv; + @r; } #sub primary_key { @@ -83,6 +87,8 @@ sub index { 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 @@ sub _show_index { push @{ $unique{ $row->{'Key_name'} } }, $row->{'Column_name'}; } } + $dbh->{FetchHashKeyName}=$oldkhv; ( $pkey, \%unique, \%index ); } -- 2.11.0