fix and regression test for RT #62642
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ODBC.pm
CommitLineData
2a57124d 1package DBIx::Class::Storage::DBI::ODBC;
2use strict;
3use warnings;
4
5use base qw/DBIx::Class::Storage::DBI/;
2ad62d97 6use mro 'c3';
ed7ab0f4 7use Try::Tiny;
fd323bf1 8use namespace::clean;
2a57124d 9
10sub _rebless {
52b420dd 11 my ($self) = @_;
12
13 try {
14 my $dbtype = $self->_get_dbh->get_info(17);
15
16 # Translate the backend name into a perl identifier
17 $dbtype =~ s/\W/_/gi;
18 my $subclass = "DBIx::Class::Storage::DBI::ODBC::${dbtype}";
19
20 if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
21 bless $self, $subclass;
22 $self->_rebless;
2a57124d 23 }
52b420dd 24 };
2a57124d 25}
26
2a57124d 271;
28
29=head1 NAME
30
31DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
32
2a57124d 33=head1 DESCRIPTION
34
35This class simply provides a mechanism for discovering and loading a sub-class
36for a specific ODBC backend. It should be transparent to the user.
37
2a57124d 38=head1 AUTHORS
39
c1e64353 40Marc Mims C<< <marc@questright.com> >>
2a57124d 41
42=head1 LICENSE
43
44You may distribute this code under the same terms as Perl itself.
45
46=cut