5 use DBIx::Class::SQLAHacks::OracleJoins;
8 use DBICTest; # do not remove even though it is not used
9 use DBIC::SqlMakerTest;
13 my $sa = new DBIx::Class::SQLAHacks::OracleJoins;
15 $sa->limit_dialect('RowNum');
17 is($sa->select('rubbish',
18 [ 'foo.id', 'bar.id', \'TO_CHAR(foo.womble, "blah")' ],
22 SELECT A.*, ROWNUM r FROM
24 SELECT foo.id AS col1, bar.id AS col2, TO_CHAR(foo.womble, "blah") AS col3 FROM rubbish
29 ', 'Munged stuff to make Oracle not explode');
32 # search with undefined or empty $cond
34 # my ($self, $table, $fields, $where, $order, @rest) = @_;
35 my ($sql, @bind) = $sa->select(
39 { "-join_type" => "LEFT", artist => "artist" },
40 { "artist.artistid" => "me.artist" },
43 [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
49 'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( artist.artistid(+) = me.artist )', [],
50 'WhereJoins search with empty where clause'
53 ($sql, @bind) = $sa->select(
57 { "-join_type" => "", artist => "artist" },
58 { "artist.artistid" => "me.artist" },
61 [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
62 { 'artist.artistid' => 3 },
67 '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],
68 'WhereJoins search with where clause'
71 ($sql, @bind) = $sa->select(
75 { "-join_type" => "LEFT", artist => "artist" },
76 { "artist.artistid" => "me.artist" },
79 [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
80 [{ 'artist.artistid' => 3 }, { 'me.cdid' => 5 }],
85 '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],
86 'WhereJoins search with or in where clause'