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);
[
$_->{'Extra'}
]
} @{ $sth->fetchall_arrayref( {} ) };
+ $dbh->{FetchHashKeyName}=$oldkhv;
+ @r;
}
#sub primary_key {
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;
push @{ $unique{ $row->{'Key_name'} } }, $row->{'Column_name'};
}
}
+ $dbh->{FetchHashKeyName}=$oldkhv;
( $pkey, \%unique, \%index );
}