From: Peter Rabbitson Date: Sat, 21 Apr 2012 04:57:41 +0000 (+0200) Subject: Remove realiasing overengineering introduced in 86bb5a27da X-Git-Tag: v0.08197~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=186ba34c1682108f16b159c06e86132371abadc9;hp=66458d5da48654e8f8558d16ce9857e5129c4dac;p=dbsrgits%2FDBIx-Class.git Remove realiasing overengineering introduced in 86bb5a27da mst is right - there is no viable use case for this, cleanse with fire Also I managed to misspell subUery... twice --- diff --git a/lib/DBIx/Class/SQLMaker/LimitDialects.pm b/lib/DBIx/Class/SQLMaker/LimitDialects.pm index d3ea35c..7639988 100644 --- a/lib/DBIx/Class/SQLMaker/LimitDialects.pm +++ b/lib/DBIx/Class/SQLMaker/LimitDialects.pm @@ -383,18 +383,6 @@ sub _prep_for_skimming_limit { # Whatever order bindvals there are, they will be realiased and # reselected, and need to show up at end of the initial inner select push @{$self->{select_bind}}, @{$self->{order_bind}}; - - # if this is a part of something bigger, we need to add back all - # the extra order_by's, as they may be relied upon by the outside - # of a prefetch or something - if ($rs_attrs->{_is_internal_subuery}) { - $sq_attrs->{selection_outer} .= sprintf ", $extra_order_sel->{$_} AS $_" - for sort - { $extra_order_sel->{$a} cmp $extra_order_sel->{$b} } - grep { $_ !~ /[^\w\-]/ } # ignore functions - keys %$extra_order_sel - ; - } } # and this is order re-alias magic diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index 1f48bc6..a8eca16 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -76,7 +76,7 @@ sub _adjust_select_args_for_complex_prefetch { my $outer_attrs = { %$attrs }; delete $outer_attrs->{$_} for qw/where bind rows offset group_by having/; - my $inner_attrs = { %$attrs, _is_internal_subuery => 1 }; + my $inner_attrs = { %$attrs }; delete $inner_attrs->{$_} for qw/for collapse _prefetch_selector_range select as/; # if the user did not request it, there is no point using it inside diff --git a/t/sqlmaker/limit_dialects/fetch_first.t b/t/sqlmaker/limit_dialects/fetch_first.t index 12b9804..302201c 100644 --- a/t/sqlmaker/limit_dialects/fetch_first.t +++ b/t/sqlmaker/limit_dialects/fetch_first.t @@ -152,7 +152,7 @@ is_same_sql_bind ( $books_45_and_owners->search ({}, { group_by => 'title', order_by => 'title' })->as_query, '(SELECT me.id, me.source, me.owner, me.price, owner.id, owner.name FROM ( - SELECT me.id, me.source, me.owner, me.price, ORDER__BY__001 AS title + SELECT me.id, me.source, me.owner, me.price FROM ( SELECT me.id, me.source, me.owner, me.price, ORDER__BY__001 FROM ( diff --git a/t/sqlmaker/limit_dialects/toplimit.t b/t/sqlmaker/limit_dialects/toplimit.t index 3c5b4d8..11f4c08 100644 --- a/t/sqlmaker/limit_dialects/toplimit.t +++ b/t/sqlmaker/limit_dialects/toplimit.t @@ -192,7 +192,7 @@ is_same_sql_bind ( $books_45_and_owners->search ({}, { group_by => 'title', order_by => 'title' })->as_query, '(SELECT me.id, me.source, me.owner, me.price, owner.id, owner.name FROM ( - SELECT me.id, me.source, me.owner, me.price, ORDER__BY__001 AS title + SELECT me.id, me.source, me.owner, me.price FROM ( SELECT TOP 2 me.id, me.source, me.owner, me.price, ORDER__BY__001