my ($self) = @_;
my @info = @{$self->_connect_info || []};
$self->_dbh($self->_connect(@info));
- my $driver = $self->_dbh->{Driver}->{Name};
+ my $dbh = $self->_dbh;
+ my $driver = $dbh->{Driver}->{Name};
+ if ( $driver eq 'ODBC' and $dbh->get_info(17) =~ m{^DB2/400} ) {
+ $driver = 'ODBC400';
+ }
eval "require DBIx::Class::Storage::DBI::${driver}";
unless ($@) {
bless $self, "DBIx::Class::Storage::DBI::${driver}";
__PACKAGE__->load_components(qw/PK::Auto Core/);
__PACKAGE__->set_primary_key('id');
- # In your Schema class
- __PACKAGE__->storage_type('::DBI::ODBC400');
-
-=for comment
-$dbh->get_info(17) returns 'DB2/400 SQL' for an active DB2/400 connection over
-ODBC. This should facility automagically loading this module when
-appropriate instead of manually specifying the storage_type as shown above.
-
=head1 DESCRIPTION