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