ODBC fixes: superfluous connection in rebless; undef PK on first insert in MSSQL
[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 $dbtype = eval { $self->_dbh->get_info(17) };
11     unless ( $@ ) {
12         # Translate the backend name into a perl identifier
13         $dbtype =~ s/\W/_/gi;
14         my $class = "DBIx::Class::Storage::DBI::ODBC::${dbtype}";
15         eval "require $class";
16         bless $self, $class unless $@;
17     }
18 }
19
20
21 1;
22
23 =head1 NAME
24
25 DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
26
27 =head1 SYNOPSIS
28
29   # In your table classes
30   __PACKAGE__->load_components(qw/Core/);
31
32
33 =head1 DESCRIPTION
34
35 This class simply provides a mechanism for discovering and loading a sub-class
36 for a specific ODBC backend.  It should be transparent to the user.
37
38
39 =head1 AUTHORS
40
41 Marc Mims C<< <marc@questright.com> >>
42
43 =head1 LICENSE
44
45 You may distribute this code under the same terms as Perl itself.
46
47 =cut