X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsqlmaker%2Foraclejoin.t;h=e8e7444192b7e89c72495d5331e45de4d50cee93;hb=f6fff270679468d60c6a3928cf8a220d52275a2d;hp=c1725e053fdaa543248382f8ee868a21465fb030;hpb=fd0353ca5ea10e0445ce2d96c46202da01a1ab7e;p=dbsrgits%2FDBIx-Class.git diff --git a/t/sqlmaker/oraclejoin.t b/t/sqlmaker/oraclejoin.t index c1725e0..e8e7444 100644 --- a/t/sqlmaker/oraclejoin.t +++ b/t/sqlmaker/oraclejoin.t @@ -15,13 +15,15 @@ use DBIx::Class::SQLMaker::OracleJoins; my $sa = DBIx::Class::SQLMaker::OracleJoins->new; +for my $rhs ( "me.artist", { -ident => "me.artist" } ) { + # my ($self, $table, $fields, $where, $order, @rest) = @_; my ($sql, @bind) = $sa->select( [ { me => "cd" }, [ { "-join_type" => "LEFT", artist => "artist" }, - { "artist.artistid" => "me.artist" }, + { "artist.artistid" => $rhs }, ], ], [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ], @@ -39,7 +41,7 @@ is_same_sql_bind( { me => "cd" }, [ { "-join_type" => "", artist => "artist" }, - { "artist.artistid" => "me.artist" }, + { "artist.artistid" => $rhs }, ], ], [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ], @@ -56,8 +58,26 @@ is_same_sql_bind( [ { me => "cd" }, [ + { "-join_type" => "right", artist => "artist" }, + { "artist.artistid" => $rhs }, + ], + ], + [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ], + { 'artist.artistid' => 3 }, + undef +); +is_same_sql_bind( + $sql, \@bind, + 'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( ( ( artist.artistid = me.artist(+) ) AND ( artist.artistid = ? ) ) )', [3], + 'WhereJoins search with where clause' +); + +($sql, @bind) = $sa->select( + [ + { me => "cd" }, + [ { "-join_type" => "LEFT", artist => "artist" }, - { "artist.artistid" => "me.artist" }, + { "artist.artistid" => $rhs }, ], ], [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ], @@ -70,5 +90,7 @@ is_same_sql_bind( 'WhereJoins search with or in where clause' ); +} + done_testing;