From: Peter Rabbitson Date: Tue, 8 Jul 2014 00:30:52 +0000 (+0200) Subject: Clearer name of method/variables before refactoring X-Git-Tag: v0.082800~151 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df4312bcd2871c005751ce8c49c98c6be3692699;p=dbsrgits%2FDBIx-Class.git Clearer name of method/variables before refactoring --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 359d692..59bd19b 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1327,7 +1327,7 @@ sub _construct_results { and $rsrc->schema ->storage - ->_main_source_order_by_portion_is_stable($rsrc, $attrs->{order_by}, $attrs->{where}) + ->_extract_colinfo_of_stable_main_source_order_by_portion($rsrc, $attrs->{order_by}, $attrs->{where}) ) ? 1 : 0 ) unless defined $attrs->{_ordered_for_collapse}; diff --git a/lib/DBIx/Class/SQLMaker/LimitDialects.pm b/lib/DBIx/Class/SQLMaker/LimitDialects.pm index da65b7c..18b5329 100644 --- a/lib/DBIx/Class/SQLMaker/LimitDialects.pm +++ b/lib/DBIx/Class/SQLMaker/LimitDialects.pm @@ -543,7 +543,7 @@ sub _GenericSubQ { . 'root-table-based order criteria.' ); - my $usable_order_ci = $root_rsrc->storage->_main_source_order_by_portion_is_stable( + my $usable_order_colinfo = $root_rsrc->storage->_extract_colinfo_of_stable_main_source_order_by_portion( $root_rsrc, $supplied_order, $rs_attrs->{where}, @@ -562,14 +562,14 @@ sub _GenericSubQ { }; # truncate to what we'll use - $#order_bits = ( (keys %$usable_order_ci) - 1 ); + $#order_bits = ( (keys %$usable_order_colinfo) - 1 ); # @order_bits likely will come back quoted (due to how the prefetch # rewriter operates # Hence supplement the column_info lookup table with quoted versions if ($self->quote_char) { - $usable_order_ci->{$self->_quote($_)} = $usable_order_ci->{$_} - for keys %$usable_order_ci; + $usable_order_colinfo->{$self->_quote($_)} = $usable_order_colinfo->{$_} + for keys %$usable_order_colinfo; } # calculate the condition @@ -584,15 +584,15 @@ sub _GenericSubQ { ($bit, my $is_desc) = $self->_split_order_chunk($bit); push @is_desc, $is_desc; - push @unqualified_names, $usable_order_ci->{$bit}{-colname}; - push @qualified_names, $usable_order_ci->{$bit}{-fq_colname}; + push @unqualified_names, $usable_order_colinfo->{$bit}{-colname}; + push @qualified_names, $usable_order_colinfo->{$bit}{-fq_colname}; - push @new_order_by, { ($is_desc ? '-desc' : '-asc') => $usable_order_ci->{$bit}{-fq_colname} }; + push @new_order_by, { ($is_desc ? '-desc' : '-asc') => $usable_order_colinfo->{$bit}{-fq_colname} }; }; my (@where_cond, @skip_colpair_stack); for my $i (0 .. $#order_bits) { - my $ci = $usable_order_ci->{$order_bits[$i]}; + my $ci = $usable_order_colinfo->{$order_bits[$i]}; my ($subq_col, $main_col) = map { "$_.$ci->{-colname}" } ($count_tbl_alias, $root_alias); my $cur_cond = { $subq_col => { ($is_desc[$i] ? '>' : '<') => { -ident => $main_col } } }; diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index 3164e5a..1bb9224 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -887,13 +887,13 @@ sub _order_by_is_stable { my @cols = ( ( map { $_->[0] } $self->_extract_order_criteria($order_by) ), ( $where ? @{ $self->_extract_fixed_condition_columns($where) || [] } : () ), - ) or return undef; + ) or return 0; my $colinfo = $self->_resolve_column_info($ident, \@cols); return keys %$colinfo ? $self->_columns_comprise_identifying_set( $colinfo, \@cols ) - : undef + : 0 ; } @@ -909,14 +909,14 @@ sub _columns_comprise_identifying_set { return 1 if $src->_identifying_column_set($_); } - return undef; + return 0; } -# this is almost identical to the above, except it accepts only +# this is almost similar to _order_by_is_stable, except it takes # a single rsrc, and will succeed only if the first portion of the order # by is stable. # returns that portion as a colinfo hashref on success -sub _main_source_order_by_portion_is_stable { +sub _extract_colinfo_of_stable_main_source_order_by_portion { my ($self, $main_rsrc, $order_by, $where) = @_; die "Huh... I expect a blessed result_source..."