Commit | Line | Data |
2a57124d |
1 | package DBIx::Class::Storage::DBI::ODBC; |
2 | use strict; |
3 | use warnings; |
2a57124d |
4 | use base qw/DBIx::Class::Storage::DBI/; |
2ad62d97 |
5 | use mro 'c3'; |
2a57124d |
6 | |
7 | sub _rebless { |
52b420dd |
8 | my ($self) = @_; |
9 | |
ab17c175 |
10 | if (my $dbtype = $self->_dbh_get_info(17)) { |
52b420dd |
11 | # Translate the backend name into a perl identifier |
12 | $dbtype =~ s/\W/_/gi; |
13 | my $subclass = "DBIx::Class::Storage::DBI::ODBC::${dbtype}"; |
14 | |
726c8f65 |
15 | return if $self->isa($subclass); |
16 | |
17 | if ($self->load_optional_class($subclass)) { |
52b420dd |
18 | bless $self, $subclass; |
19 | $self->_rebless; |
2a57124d |
20 | } |
ab17c175 |
21 | else { |
22 | warn "Expected driver '$subclass' not found, using generic support. " . |
23 | "Please file an RT.\n"; |
24 | } |
25 | } |
26 | else { |
27 | warn "Could not determine your database type, using generic support.\n"; |
4888397f |
28 | } |
2a57124d |
29 | } |
30 | |
2a57124d |
31 | 1; |
32 | |
33 | =head1 NAME |
34 | |
35 | DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers |
36 | |
2a57124d |
37 | =head1 DESCRIPTION |
38 | |
39 | This class simply provides a mechanism for discovering and loading a sub-class |
40 | for a specific ODBC backend. It should be transparent to the user. |
41 | |
ab17c175 |
42 | =head1 AUTHOR |
2a57124d |
43 | |
ab17c175 |
44 | See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>. |
2a57124d |
45 | |
46 | =head1 LICENSE |
47 | |
48 | You may distribute this code under the same terms as Perl itself. |
49 | |
50 | =cut |
ab17c175 |
51 | # vim:sts=2 sw=2: |