X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLAHacks.pm;h=f44ed4f462572398842fca02bfd8e8db08968ecc;hb=aa82ce29dcf525f22133a0c6bc9cd9c611767792;hp=d5041ba19069461c8ae9e4fa1a3d47710d9dbab1;hpb=324bc21498b1df5a13c87bbd5209b85985d1743f;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index d5041ba..f44ed4f 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -508,15 +508,21 @@ sub _recurse_from { foreach my $j (@join) { my ($to, $on) = @$j; + # check whether a join type exists - my $join_clause = ''; my $to_jt = ref($to) eq 'ARRAY' ? $to->[0] : $to; - if (ref($to_jt) eq 'HASH' and exists($to_jt->{-join_type})) { - $join_clause = ' '.uc($to_jt->{-join_type}).' JOIN '; - } else { - $join_clause = ' JOIN '; + my $join_type; + if (ref($to_jt) eq 'HASH' and defined($to_jt->{-join_type})) { + $join_type = $to_jt->{-join_type}; + $join_type =~ s/^\s+ | \s+$//xg; } - push(@sqlf, $join_clause); + + $join_type ||= $self->_default_jointype; + + my $join_clause = sprintf ('%s JOIN ', + $join_type ? ' ' . uc($join_type) : '' + ); + push @sqlf, $join_clause; if (ref $to eq 'ARRAY') { push(@sqlf, '(', $self->_recurse_from(@$to), ')'); @@ -528,6 +534,8 @@ sub _recurse_from { return join('', @sqlf); } +sub _default_jointype {}; + sub _fold_sqlbind { my ($self, $sqlbind) = @_;