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