Display a warning when an ODBC or ADO subclass is not found
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ODBC.pm
CommitLineData
2a57124d 1package DBIx::Class::Storage::DBI::ODBC;
2use strict;
3use warnings;
2a57124d 4use base qw/DBIx::Class::Storage::DBI/;
2ad62d97 5use mro 'c3';
2a57124d 6
7sub _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
15 if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
16 bless $self, $subclass;
17 $self->_rebless;
2a57124d 18 }
ab17c175 19 else {
20 warn "Expected driver '$subclass' not found, using generic support. " .
21 "Please file an RT.\n";
22 }
23 }
24 else {
25 warn "Could not determine your database type, using generic support.\n";
4888397f 26 }
2a57124d 27}
28
2a57124d 291;
30
31=head1 NAME
32
33DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
34
2a57124d 35=head1 DESCRIPTION
36
37This class simply provides a mechanism for discovering and loading a sub-class
38for a specific ODBC backend. It should be transparent to the user.
39
ab17c175 40=head1 AUTHOR
2a57124d 41
ab17c175 42See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
2a57124d 43
44=head1 LICENSE
45
46You may distribute this code under the same terms as Perl itself.
47
48=cut
ab17c175 49# vim:sts=2 sw=2: