use vars qw($VERSION @ISA %typemap);
use DBIx::DBSchema::DBD;
-$VERSION = '0.02';
+$VERSION = '0.05';
@ISA = qw(DBIx::DBSchema::DBD);
%typemap = (
- 'TIMESTAMP' => 'DATETIME',
- 'SERIAL' => 'INTEGER',
+ 'TIMESTAMP' => 'DATETIME',
+ 'SERIAL' => 'INTEGER',
+ 'BOOL' => 'TINYINT',
+ 'LONG VARBINARY' => 'LONGBLOB',
);
=head1 NAME
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+)\(?([\d\,]+)?\)?( 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 );
}