Merge 'trunk' into 'replication_dedux'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ODBC.pm
1 package DBIx::Class::Storage::DBI::ODBC;
2 use strict;
3 use warnings;
4
5 use base qw/DBIx::Class::Storage::DBI/;
6
7 sub _rebless {
8     my ($self) = @_;
9
10     my $dbh = $self->dbh;
11     my $dbtype = eval { $dbh->get_info(17) };
12     unless ( $@ ) {
13         # Translate the backend name into a perl identifier
14         $dbtype =~ s/\W/_/gi;
15         my $class = "DBIx::Class::Storage::DBI::ODBC::${dbtype}";
16         eval "require $class";
17         bless $self, $class unless $@;
18     }
19 }
20
21
22 1;
23
24 =head1 NAME
25
26 DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
27
28 =head1 SYNOPSIS
29
30   # In your table classes
31   __PACKAGE__->load_components(qw/Core/);
32
33
34 =head1 DESCRIPTION
35
36 This class simply provides a mechanism for discovering and loading a sub-class
37 for a specific ODBC backend.  It should be transparent to the user.
38
39
40 =head1 AUTHORS
41
42 Marc Mims C<< <marc@questright.com> >>
43
44 =head1 LICENSE
45
46 You may distribute this code under the same terms as Perl itself.
47
48 =cut