my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE artist_id IN ( SELECT id FROM artist me LIMIT 1 )",
+ "( SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE artist_id IN ( SELECT id FROM artist me LIMIT 1 ) )",
[],
);
}
my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT (SELECT id FROM cd me LIMIT 1) FROM artist me",
+ "( SELECT (SELECT id FROM cd me LIMIT 1) FROM artist me )",
[],
);
}
my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT me.artistid, me.name, me.rank, me.charfield, (SELECT id FROM cd me LIMIT 1) FROM artist me",
+ "( SELECT me.artistid, me.name, me.rank, me.charfield, (SELECT id FROM cd me LIMIT 1) FROM artist me )",
[],
);
}
my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track FROM (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE id > 20) cd2",
+ "( SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track FROM (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE id > 20) cd2 )",
[],
);
}
my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me JOIN (SELECT me.artist as cds_artist FROM cd me) cds ON me.artistid = cds_artist", []
+ "( SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me JOIN (SELECT me.artist as cds_artist FROM cd me) cds ON me.artistid = cds_artist )", []
);
my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track
+ "( SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track
FROM
(SELECT cd3.cdid,cd3.artist,cd3.title,cd3.year,cd3.genreid,cd3.single_track
FROM
(SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track
FROM cd me WHERE id < 40) cd3
- WHERE id > 20) cd2",
+ WHERE id > 20) cd2
+ )",
[],
);
my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE year = (SELECT MAX(inner.year) FROM cd inner WHERE artistid = me.artistid)",
+ "( SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE year = (SELECT MAX(inner.year) FROM cd inner WHERE artistid = me.artistid) )",
[],
);
}