7 require DBIx::Class::Optional::Dependencies;
8 plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener')
9 unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener');
13 use DBICTest ':DiffSQL';
14 use DBIx::Class::SQLMaker::OracleJoins;
16 my $sa = DBIx::Class::SQLMaker::OracleJoins->new;
18 for my $rhs ( "me.artist", { -ident => "me.artist" } ) {
20 # my ($self, $table, $fields, $where, $order, @rest) = @_;
21 my ($sql, @bind) = $sa->select(
25 { "-join_type" => "LEFT", artist => "artist" },
26 { "artist.artistid" => $rhs },
29 [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
35 'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( artist.artistid(+) = me.artist )', [],
36 'WhereJoins search with empty where clause'
39 ($sql, @bind) = $sa->select(
43 { "-join_type" => "", artist => "artist" },
44 { "artist.artistid" => $rhs },
47 [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
48 { 'artist.artistid' => 3 },
53 '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],
54 'WhereJoins search with where clause'
57 ($sql, @bind) = $sa->select(
61 { "-join_type" => "right", artist => "artist" },
62 { "artist.artistid" => $rhs },
65 [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
66 { 'artist.artistid' => 3 },
71 '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],
72 'WhereJoins search with where clause'
75 ($sql, @bind) = $sa->select(
79 { "-join_type" => "LEFT", artist => "artist" },
80 { "artist.artistid" => $rhs },
83 [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
84 [{ 'artist.artistid' => 3 }, { 'me.cdid' => 5 }],
89 '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 = ? ) OR ( me.cdid = ? ) ) ) ) )', [3, 5],
90 'WhereJoins search with or in where clause'