support ::DBI::Replicated opts in connect_info
[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
2eebd801 10 my $dbtype = eval { $self->_dbh->get_info(17) };
2a57124d 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
455833d9 20sub _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}
2a57124d 28
291;
30
31=head1 NAME
32
33DBIx::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
43This class simply provides a mechanism for discovering and loading a sub-class
44for a specific ODBC backend. It should be transparent to the user.
45
46
47=head1 AUTHORS
48
c1e64353 49Marc Mims C<< <marc@questright.com> >>
2a57124d 50
51=head1 LICENSE
52
53You may distribute this code under the same terms as Perl itself.
54
55=cut