X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=t%2F73oracle.t;h=cde22cd5998a7b00f58491f70bca9909856d710a;hp=734e4119b906a6f88ee09a8131e53a5c9d5100b5;hb=37aafa2ede65e38af8fe9eda374ad4626290932f;hpb=0ac0af6c62637a5fdb06ecfb8ba4b60f93bf9d75 diff --git a/t/73oracle.t b/t/73oracle.t index 734e411..cde22cd 100644 --- a/t/73oracle.t +++ b/t/73oracle.t @@ -618,27 +618,27 @@ if ( $schema->storage->isa('DBIx::Class::Storage::DBI::Oracle::Generic') ) { # combine a connect_by with group_by and having { my $rs = $schema->resultset('Artist')->search({}, { - select => ['count(rank)'], + select => { count => 'rank', -as => 'cnt' }, start_with => { name => 'root' }, connect_by => { parentid => { -prior => { -ident => 'artistid' } } }, group_by => ['rank'], - having => { 'count(rank)' => { '<', 2 } }, + having => \[ 'count(rank) < ?', [ cnt => 2 ] ], }); is_same_sql_bind ( $rs->as_query, '( - SELECT count(rank) + SELECT COUNT(rank) AS cnt FROM artist me START WITH name = ? CONNECT BY parentid = PRIOR artistid GROUP BY rank HAVING count(rank) < ? )', - [ [ name => 'root' ], [ 'count(rank)' => 2 ] ], + [ [ name => 'root' ], [ cnt => 2 ] ], ); is_deeply ( - [ $rs->get_column ('count(rank)')->all ], + [ $rs->get_column ('cnt')->all ], [1, 1], 'Group By a Connect By query - correct values' ); @@ -667,7 +667,8 @@ if ( $schema->storage->isa('DBIx::Class::Storage::DBI::Oracle::Generic') ) { my $rs = $schema->resultset('Artist')->search({}, { start_with => { name => 'cycle-root' }, - '+select' => [ \ 'CONNECT_BY_ISCYCLE' ], + '+select' => \ 'CONNECT_BY_ISCYCLE', + '+as' => [ 'connector' ], connect_by_nocycle => { parentid => { -prior => { -ident => 'artistid' } } }, }); @@ -687,7 +688,7 @@ if ( $schema->storage->isa('DBIx::Class::Storage::DBI::Oracle::Generic') ) { 'got artist tree with nocycle (name)', ); is_deeply ( - [ $rs->get_column ('CONNECT_BY_ISCYCLE')->all ], + [ $rs->get_column ('connector')->all ], [ qw/1 0 0 0/ ], 'got artist tree with nocycle (CONNECT_BY_ISCYCLE)', );