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