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