support ::DBI::Replicated opts in connect_info
[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 sub _dbh_last_insert_id {
21     my ($self, $dbh, $source, $col) = @_;
22
23     # punt: if there is no derived class for the specific backend, attempt
24     # to use the DBI->last_insert_id, which may not be sufficient (see the
25     # discussion of last_insert_id in perldoc DBI)
26     return $dbh->last_insert_id(undef, undef, $source->from, $col);
27 }
28
29 1;
30
31 =head1 NAME
32
33 DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
34
35 =head1 SYNOPSIS
36
37   # In your table classes
38   __PACKAGE__->load_components(qw/Core/);
39
40
41 =head1 DESCRIPTION
42
43 This class simply provides a mechanism for discovering and loading a sub-class
44 for a specific ODBC backend.  It should be transparent to the user.
45
46
47 =head1 AUTHORS
48
49 Marc Mims C<< <marc@questright.com> >>
50
51 =head1 LICENSE
52
53 You may distribute this code under the same terms as Perl itself.
54
55 =cut