Generalized the loading of subclasses for specfic ODBC backends.
[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/;
6
7sub _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
221;
23
24=head1 NAME
25
26DBIx::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
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
39
40=head1 AUTHORS
41
42Marc Mims C<< <marc@sssonline.com> >>
43
44=head1 LICENSE
45
46You may distribute this code under the same terms as Perl itself.
47
48=cut