Merge 'trunk' into 'replication_dedux'
[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/;
843f8ecd 7
18360aed 8sub _rebless {
9382ad07 9 my ($self) = @_;
843f8ecd 10
9382ad07 11 my $version = eval { $self->_dbh->get_info(18); };
0680ac39 12
9382ad07 13 if ( !$@ ) {
14 my ($major, $minor, $patchlevel) = split(/\./, $version);
843f8ecd 15
9382ad07 16 # Default driver
08fabf59 17 my $class = $major <= 8
9382ad07 18 ? 'DBIx::Class::Storage::DBI::Oracle::WhereJoins'
19 : 'DBIx::Class::Storage::DBI::Oracle::Generic';
843f8ecd 20
9382ad07 21 # Load and rebless
22 eval "require $class";
099049b5 23
9382ad07 24 bless $self, $class unless $@;
25 }
099049b5 26}
27
adb3554a 28sub _svp_begin {
eeb8cfeb 29 my ($self, $name) = @_;
adb3554a 30
eeb8cfeb 31 $self->dbh->do("SAVEPOINT $name");
adb3554a 32}
33
34# Would've implemented _svp_release here, but Oracle doesn't support it.
35
36sub _svp_rollback {
eeb8cfeb 37 my ($self, $name) = @_;
adb3554a 38
eeb8cfeb 39 $self->dbh->do("ROLLBACK TO SAVEPOINT $name")
adb3554a 40}
099049b5 41
843f8ecd 421;
43
75d07914 44=head1 NAME
843f8ecd 45
18360aed 46DBIx::Class::Storage::DBI::Oracle - Base class for Oracle driver
843f8ecd 47
48=head1 SYNOPSIS
49
50 # In your table classes
18360aed 51 __PACKAGE__->load_components(qw/Core/);
843f8ecd 52
53=head1 DESCRIPTION
54
18360aed 55This class simply provides a mechanism for discovering and loading a sub-class
08fabf59 56for a specific version Oracle backend. It should be transparent to the user.
843f8ecd 57
08fabf59 58For Oracle major versions <= 8 it loads the ::Oracle::WhereJoins subclass,
59which unrolls the ANSI join style DBIC normally generates into entries in
60the WHERE clause for compatibility purposes. To force usage of this version
61no matter the database version, add
62
63 __PACKAGE__->storage_type('::DBI::Oracle::WhereJoins');
64
65to your Schema class.
843f8ecd 66
18360aed 67=head1 AUTHORS
843f8ecd 68
18360aed 69David Jack Olrik C<< <djo@cpan.org> >>
843f8ecd 70
71=head1 LICENSE
72
73You may distribute this code under the same terms as Perl itself.
74
75=cut