From: Rob Kinyon Date: Wed, 11 Feb 2009 14:45:23 +0000 (+0000) Subject: check in bombing test for subquery-with-as_query X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4dc99a0129f68ed7f37b188fd731a49f03715dd2;p=dbsrgits%2FDBIx-Class-Historic.git check in bombing test for subquery-with-as_query --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index febd181..edd9bd3 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1715,7 +1715,7 @@ sub _remove_alias { =item Arguments: none -=item Return Value: [ $sql, @bind ] +=item Return Value: \[ $sql, @bind ] =back diff --git a/lib/DBIx/Class/ResultSetColumn.pm b/lib/DBIx/Class/ResultSetColumn.pm index f272592..78fd44a 100644 --- a/lib/DBIx/Class/ResultSetColumn.pm +++ b/lib/DBIx/Class/ResultSetColumn.pm @@ -60,7 +60,7 @@ sub new { =item Arguments: none -=item Return Value: [ $sql, @bind ] +=item Return Value: \[ $sql, @bind ] =back diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index 6a29f46..6c90191 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -55,7 +55,7 @@ sub new { =item Arguments: none -=item Return Value: [ $sql, @bind ] +=item Return Value: \[ $sql, @bind ] =back @@ -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/resultset/as_query.t b/t/resultset/as_query.t index b4fa422..43c8ddd 100644 --- a/t/resultset/as_query.t +++ b/t/resultset/as_query.t @@ -10,12 +10,13 @@ use DBIC::SqlMakerTest; plan tests => 4; -my $schema = DBICTest->init_schema(); -my $art_rs = $schema->resultset('Artist'); +my $schema = DBICTest->init_schema(); +my $art_rs = $schema->resultset('Artist'); +my $cdrs = $schema->resultset('CD'); { my $arr = $art_rs->as_query; - my ($query, @bind) = @$arr; + my ($query, @bind) = @{$$arr}; is_same_sql_bind( $query, \@bind, @@ -27,7 +28,7 @@ $art_rs = $art_rs->search({ name => 'Billy Joel' }); { my $arr = $art_rs->as_query; - my ($query, @bind) = @$arr; + my ($query, @bind) = @{$$arr}; is_same_sql_bind( $query, \@bind, @@ -40,7 +41,7 @@ $art_rs = $art_rs->search({ rank => 2 }); { my $arr = $art_rs->as_query; - my ($query, @bind) = @$arr; + my ($query, @bind) = @{$$arr}; is_same_sql_bind( $query, \@bind, @@ -53,7 +54,7 @@ my $rscol = $art_rs->get_column( 'charfield' ); { my $arr = $rscol->as_query; - my ($query, @bind) = @$arr; + my ($query, @bind) = @{$$arr}; is_same_sql_bind( $query, \@bind, @@ -62,4 +63,18 @@ my $rscol = $art_rs->get_column( 'charfield' ); ); } +my $cdrs2 = $cdrs->search({ + artist_id => { + -in => $art_rs->get_column( 'id' )->as_query, + }, +}); + +my @x = $cdrs2->all; +use Data::Dumper; warn Dumper \@x; +__END__ +{ + my $arr = $cdrs2->as_query; + my ($query, @bind) = @{$$arr}; +} + __END__