From: Matt S Trout Date: Sat, 14 Apr 2012 19:17:23 +0000 (+0000) Subject: ON and LEFT/RIGHT X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f95eef175480f11de39cb1d3e2c254fbc2fdd87;p=dbsrgits%2FData-Query.git ON and LEFT/RIGHT --- diff --git a/lib/Data/Query/Renderer/SQL/Naive.pm b/lib/Data/Query/Renderer/SQL/Naive.pm index 96ca1f8..5f31efe 100644 --- a/lib/Data/Query/Renderer/SQL/Naive.pm +++ b/lib/Data/Query/Renderer/SQL/Naive.pm @@ -324,9 +324,21 @@ sub _render_literal { sub _render_join { my ($self, $dq) = @_; my ($left, $right) = @{$dq->{join}}; - die "No support for ON yet" if $dq->{on}; - die "No support for LEFT/RIGHT yet" if $dq->{outer}; - [ $self->_render($left), ',', $self->_render($right) ]; + my $join = do { + if ($dq->{outer}) { + $self->_format_keyword(uc($dq->{outer}).' JOIN'); + } elsif ($dq->{on}) { + $self->_format_keyword('JOIN'); + } else { + ',' + } + }; + [ + $self->_render($left), $join, $self->_render($right), + ($dq->{on} + ? ($self->_format_keyword('ON'), $self->_render($dq->{on})) + : ()) + ]; } sub _render_where {