fix and regression test for RT #62642
[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';
ed7ab0f4 8use Try::Tiny;
fd323bf1 9use namespace::clean;
843f8ecd 10
18360aed 11sub _rebless {
9382ad07 12 my ($self) = @_;
843f8ecd 13
52b420dd 14 try {
15 my $version = $self->_get_dbh->get_info(18);
16
17 my ($major, $minor, $patchlevel) = split(/\./, $version);
18
19 # Default driver
20 my $class = $major <= 8
21 ? 'DBIx::Class::Storage::DBI::Oracle::WhereJoins'
22 : 'DBIx::Class::Storage::DBI::Oracle::Generic';
23
24 $self->ensure_class_loaded ($class);
25 bless $self, $class;
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
843f8ecd 35=head1 DESCRIPTION
36
18360aed 37This class simply provides a mechanism for discovering and loading a sub-class
08fabf59 38for a specific version Oracle backend. It should be transparent to the user.
843f8ecd 39
08fabf59 40For Oracle major versions <= 8 it loads the ::Oracle::WhereJoins subclass,
41which unrolls the ANSI join style DBIC normally generates into entries in
42the WHERE clause for compatibility purposes. To force usage of this version
43no matter the database version, add
44
45 __PACKAGE__->storage_type('::DBI::Oracle::WhereJoins');
46
47to your Schema class.
843f8ecd 48
18360aed 49=head1 AUTHORS
843f8ecd 50
18360aed 51David Jack Olrik C<< <djo@cpan.org> >>
843f8ecd 52
53=head1 LICENSE
54
55You may distribute this code under the same terms as Perl itself.
56
57=cut