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