Commit | Line | Data |
2a57124d |
1 | package DBIx::Class::Storage::DBI::ODBC; |
2 | use strict; |
3 | use warnings; |
4 | |
5 | use base qw/DBIx::Class::Storage::DBI/; |
2ad62d97 |
6 | use mro 'c3'; |
ed7ab0f4 |
7 | use Try::Tiny; |
fd323bf1 |
8 | use namespace::clean; |
2a57124d |
9 | |
10 | sub _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 |
27 | 1; |
28 | |
29 | =head1 NAME |
30 | |
31 | DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers |
32 | |
2a57124d |
33 | =head1 DESCRIPTION |
34 | |
35 | This class simply provides a mechanism for discovering and loading a sub-class |
36 | for a specific ODBC backend. It should be transparent to the user. |
37 | |
2a57124d |
38 | =head1 AUTHORS |
39 | |
c1e64353 |
40 | Marc Mims C<< <marc@questright.com> >> |
2a57124d |
41 | |
42 | =head1 LICENSE |
43 | |
44 | You may distribute this code under the same terms as Perl itself. |
45 | |
46 | =cut |