From: Peter Rabbitson Date: Thu, 24 Dec 2009 15:22:30 +0000 (+0000) Subject: Ordered subqueries do not work in mssql after all X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d09c3ce73941decb9c4e7c544a81629eaa1a049f;p=dbsrgits%2FDBIx-Class-Historic.git Ordered subqueries do not work in mssql after all --- diff --git a/t/746mssql.t b/t/746mssql.t index e934d6f..c32797a 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -220,6 +220,7 @@ lives_ok ( sub { ]); }, 'populate with PKs supplied ok' ); + lives_ok (sub { # start a new connection, make sure rebless works # test an insert with a supplied identity, followed by one without @@ -256,7 +257,8 @@ lives_ok ( sub { # make sure ordered subselects work { - my $owners = $schema->resultset ('Owners')->search ({}, { order_by => 'name' }); + my $owners = $schema->resultset ('Owners')->search ({}, { order_by => 'name', offset => 2, rows => 3 }); + my $al = $owners->current_source_alias; my $sealed_owners = $owners->result_source->resultset->search ( {}, @@ -275,6 +277,22 @@ lives_ok ( sub { [ map { $_->name } ($owners->all) ], 'Sort preserved from within a subquery', ); + + + my $corelated_owners = $owners->result_source->resultset->search ( + { + id => { -in => $owners->get_column('id')->as_query }, + }, + { + order_by => 'name' + }, + ); + + is_deeply ( + [ map { $_->name } ($corelated_owners->all) ], + [ map { $_->name } ($owners->all) ], + 'Sort preserved from within a corelated subquery', + ); } TODO: {