1 package DBIx::Class::Storage::DBI::Oracle::8;
3 use base qw( DBIx::Class::Storage::DBI::Oracle::Generic );
9 package DBIC::SQL::Abstract::Oracle8;
11 use base qw( DBIC::SQL::Abstract );
14 my ($self, $table, $fields, $where, $order, @rest) = @_;
16 $self->_oracle_joins($where, @{ $table });
18 return $self->SUPER::select($table, $fields, $where, $order, @rest);
22 my ($self, $from, @join) = @_;
24 my @sqlf = $self->_make_as($from);
26 foreach my $j (@join) {
27 my ($to, $on) = @{ $j };
29 if (ref $to eq 'ARRAY') {
30 push (@sqlf, $self->_recurse_from(@{ $to }));
33 push (@sqlf, $self->_make_as($to));
37 return join q{, }, @sqlf;
41 my ($self, $where, $from, @join) = @_;
43 foreach my $j (@join) {
44 my ($to, $on) = @{ $j };
46 if (ref $to eq 'ARRAY') {
47 $self->_oracle_joins($where, @{ $to });
50 my $to_jt = ref $to eq 'ARRAY' ? $to->[0] : $to;
54 if (ref $to_jt eq 'HASH' and exists $to_jt->{-join_type}) {
55 #TODO: Support full outer joins -- this would happen much earlier in
56 #the sequence since oracle 8's full outer join syntax is best
58 die "Can't handle full outer joins in Oracle 8 yet!\n"
59 if $to_jt->{-join_type} =~ /full/i;
61 $left_join = q{(+)} if $to_jt->{-join_type} =~ /right/i
62 && $to_jt->{-join_type} !~ /inner/i;
64 $right_join = q{(+)} if $to_jt->{-join_type} =~ /left/i
65 && $to_jt->{-join_type} !~ /inner/i;
68 foreach my $lhs (keys %{ $on }) {
69 $where->{$lhs . $left_join} = \" = $on->{ $lhs }$right_join";
78 unless ($self->_sql_maker) {
80 new DBIC::SQL::Abstract::Oracle8( $self->_sql_maker_args )
84 return $self->_sql_maker;
95 DBIx::Class::Storage::DBI::Oracle::8
99 When initialising your code in the base DBIx module, simply tell DBIx to use
100 this as a storage class, and you're set:
102 use base qw( DBIx::Class::Schema );
104 __PACKAGE__->load_classes();
108 This class implements support specific to Oracle 8, as Oracle does not support:
110 SELECT x FROM y JOIN z ON y.id = z.id
112 Oracle requires the query by written as:
114 SELECT x FROM y, z WHERE y.id = z.id
116 This module attempts to support that.
118 It should properly support left joins, and right joins. Full outer joins are
119 not possible due to the fact that Oracle 8 requires the entire query be
120 written to union the results of a left and right join, and by the time this
121 module is called to create the where query and table definition part of the
122 sql query, it's already too late.
126 This module replaces a subroutine contained in DBIC::SQL::Abstract:
134 It also creates a new module in its BEGIN { } block called
135 DBIC::SQL::Abstract::Oracle8 which has the following methods:
139 =item select ($\@$;$$@)
141 Replaces DBIC::SQL::Abstract's select() method, which calls _oracle_joins()
142 to modify the column and table list before calling SUPER::select().
144 =item _recurse_from ($$\@)
146 Recursive subroutine that builds the table list.
148 =item _oracle_joins ($$$@)
150 Creates the left/right relationship in the where query.
156 Does not support full outer joins.
163 =item L<DBIC::SQL::Abstract>
171 Justin Wheeler C<< <justin.wheeler@caledoncard.com> >>
175 David Jack Olrik C<< <djo@cpan.org> >>
179 This module is licensed under the same terms as Perl itself.