From: Rob Kinyon Date: Wed, 18 Feb 2009 16:52:42 +0000 (+0000) Subject: as_query now provides its own parens X-Git-Tag: v0.08240~63^2~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=da0b073b7f043342791997b1eb823acc892e370b;p=dbsrgits%2FDBIx-Class.git as_query now provides its own parens --- diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index 6c90191..60df379 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -72,7 +72,7 @@ sub as_query { my @args = $storage->_select_args(@{$self->{args}}); my ($sql, $bind) = $storage->_prep_for_execute(@args[0 .. 2], [@args[4 .. $#args]]); - return \[ $sql, @$bind ]; + return \[ "($sql)", @$bind ]; } =head2 next diff --git a/t/search/subquery.t b/t/search/subquery.t index ed91419..f6a00dd 100644 --- a/t/search/subquery.t +++ b/t/search/subquery.t @@ -46,7 +46,6 @@ TODO: { my $arr = $rs->as_query; my ($query, @bind) = @{$$arr}; -warn "$query\n"; is_same_sql_bind( $query, \@bind, "SELECT me.artistid, me.name, me.rank, me.charfield, (SELECT id FROM cds LIMIT 1) AS cdid FROM artist me", @@ -89,7 +88,7 @@ TODO: { my ($query, @bind) = @{$$arr}; is_same_sql_bind( $query, \@bind, - "SELECT me.cdid, me.artistid, me.rank, me.charfield 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)", [], ); }