X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FMSSQL.pm;h=28b87f2ed6755699c81a74f8186d8a1236a14af7;hb=6553ac3837081c481ecdf269c7aff407c348a807;hp=cfbc634d3342f0511c0d7d157e36bf2618f1ecf4;hpb=17555a0c43f9bfb63cb953ac797edca4b93390b7;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/MSSQL.pm index cfbc634..28b87f2 100644 --- a/lib/DBIx/Class/Storage/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Storage/DBI/MSSQL.pm @@ -185,11 +185,21 @@ sub last_insert_id { shift->_identity } sub _select_args_to_query { my $self = shift; + # _select_args does some shady action at a distance + # see DBI.pm for more info my $sql_maker = $self->sql_maker; - my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order) = $self->_select_args(@_); + my ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset); + { + local $sql_maker->{_dbic_rs_attrs}; + ($op, $bind, $ident, $bind_attrs, $select, $cond, $order, $rows, $offset) = $self->_select_args(@_); + } - if (not scalar $sql_maker->_order_by_chunks ($order->{order_by}) ) { - # no ordering, just short circuit + if ( + ($rows || $offset) + || + not scalar $sql_maker->_order_by_chunks ($order->{order_by}) + ) { + # either limited RS or no ordering, just short circuit return $self->next::method (@_); }