From: Andres Kievsky Date: Sun, 4 Sep 2005 21:24:10 +0000 (+0000) Subject: Reverted andyg's fixes to DBI.pm, updated tests accordingly. X-Git-Tag: v0.03001~18^2~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=96cdbbab80423039153fb348efeeda760f4eb9b4;p=dbsrgits%2FDBIx-Class.git Reverted andyg's fixes to DBI.pm, updated tests accordingly. --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 8b35adb..6b96ba5 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -47,7 +47,7 @@ sub _recurse_from { if (ref $to eq 'ARRAY') { push(@sqlf, '(', $self->_recurse_from(@$to), ')'); } else { - push(@sqlf, '(', $self->_make_as($to), ')'); + push(@sqlf, $self->_make_as($to)); } push(@sqlf, ' ON ', $self->_join_condition($on)); } @@ -56,7 +56,7 @@ sub _recurse_from { sub _make_as { my ($self, $from) = @_; - return join(' AS ', reverse each %{$self->_skip_options($from)}); + return join(' ', reverse each %{$self->_skip_options($from)}); } sub _skip_options { diff --git a/t/16joins.t b/t/16joins.t index 7360213..1faea6e 100644 --- a/t/16joins.t +++ b/t/16joins.t @@ -20,8 +20,8 @@ my @j = ( [ { father => 'person' }, { 'father.person_id' => 'child.father_id' }, ], [ { mother => 'person' }, { 'mother.person_id' => 'child.mother_id' } ], ); -my $match = 'person AS child JOIN (person AS father) ON ( father.person_id = ' - . 'child.father_id ) JOIN (person AS mother) ON ( mother.person_id ' +my $match = 'person child JOIN person father ON ( father.person_id = ' + . 'child.father_id ) JOIN person mother ON ( mother.person_id ' . '= child.mother_id )' ; is( $sa->_recurse_from(@j), $match, 'join 1 ok' ); @@ -36,7 +36,7 @@ my @j2 = ( { 'mother.person_id' => 'child.mother_id' } ], ); -$match = 'person AS mother JOIN (person AS child JOIN (person AS father) ON (' +$match = 'person mother JOIN (person child JOIN person father ON (' . ' father.person_id = child.father_id )) ON ( mother.person_id = ' . 'child.mother_id )' ; @@ -47,8 +47,8 @@ my @j3 = ( [ { father => 'person', -join_type => 'inner' }, { 'father.person_id' => 'child.father_id' }, ], [ { mother => 'person', -join_type => 'inner' }, { 'mother.person_id' => 'child.mother_id' } ], ); -my $match = 'person AS child INNER JOIN (person AS father) ON ( father.person_id = ' - . 'child.father_id ) INNER JOIN (person AS mother) ON ( mother.person_id ' +my $match = 'person child INNER JOIN person father ON ( father.person_id = ' + . 'child.father_id ) INNER JOIN person mother ON ( mother.person_id ' . '= child.mother_id )' ;