Caelum was right to make _get_dbh private - reverting (and some code refactoring)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Oracle.pm
CommitLineData
843f8ecd 1package DBIx::Class::Storage::DBI::Oracle;
2
3use strict;
4use warnings;
5
18360aed 6use base qw/DBIx::Class::Storage::DBI/;
2ad62d97 7use mro 'c3';
843f8ecd 8
18360aed 9sub _rebless {
9382ad07 10 my ($self) = @_;
843f8ecd 11
9ae966b9 12 my $version = eval { $self->_get_dbh->get_info(18); };
0680ac39 13
9382ad07 14 if ( !$@ ) {
15 my ($major, $minor, $patchlevel) = split(/\./, $version);
843f8ecd 16
9382ad07 17 # Default driver
08fabf59 18 my $class = $major <= 8
9382ad07 19 ? 'DBIx::Class::Storage::DBI::Oracle::WhereJoins'
20 : 'DBIx::Class::Storage::DBI::Oracle::Generic';
843f8ecd 21
9382ad07 22 # Load and rebless
23 eval "require $class";
099049b5 24
9382ad07 25 bless $self, $class unless $@;
26 }
099049b5 27}
28
843f8ecd 291;
30
75d07914 31=head1 NAME
843f8ecd 32
18360aed 33DBIx::Class::Storage::DBI::Oracle - Base class for Oracle driver
843f8ecd 34
35=head1 SYNOPSIS
36
37 # In your table classes
18360aed 38 __PACKAGE__->load_components(qw/Core/);
843f8ecd 39
40=head1 DESCRIPTION
41
18360aed 42This class simply provides a mechanism for discovering and loading a sub-class
08fabf59 43for a specific version Oracle backend. It should be transparent to the user.
843f8ecd 44
08fabf59 45For Oracle major versions <= 8 it loads the ::Oracle::WhereJoins subclass,
46which unrolls the ANSI join style DBIC normally generates into entries in
47the WHERE clause for compatibility purposes. To force usage of this version
48no matter the database version, add
49
50 __PACKAGE__->storage_type('::DBI::Oracle::WhereJoins');
51
52to your Schema class.
843f8ecd 53
18360aed 54=head1 AUTHORS
843f8ecd 55
18360aed 56David Jack Olrik C<< <djo@cpan.org> >>
843f8ecd 57
58=head1 LICENSE
59
60You may distribute this code under the same terms as Perl itself.
61
62=cut