All expected evals converted to try, except where no test is done,
[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;
2a57124d 8
9sub _rebless {
10 my ($self) = @_;
11
ed7ab0f4 12 my $caught;
13 my $dbtype;
14 try { $self->_get_dbh->get_info(17) }
15 catch { $caught = 1 };
ef131d82 16
ed7ab0f4 17 unless ( $caught ) {
2a57124d 18 # Translate the backend name into a perl identifier
19 $dbtype =~ s/\W/_/gi;
4a9a13c8 20 my $subclass = "DBIx::Class::Storage::DBI::ODBC::${dbtype}";
21 if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
22 bless $self, $subclass;
23 $self->_rebless;
24 }
2a57124d 25 }
26}
27
2a57124d 281;
29
30=head1 NAME
31
32DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
33
2a57124d 34=head1 DESCRIPTION
35
36This class simply provides a mechanism for discovering and loading a sub-class
37for a specific ODBC backend. It should be transparent to the user.
38
2a57124d 39=head1 AUTHORS
40
c1e64353 41Marc Mims C<< <marc@questright.com> >>
2a57124d 42
43=head1 LICENSE
44
45You may distribute this code under the same terms as Perl itself.
46
47=cut