X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLMaker%2FLimitDialects.pm;h=294c57924784ee4da0c52ea069e3d8a06c6d84f0;hb=4c2b30d6e53cd05e570ad112e87ad6f96355f695;hp=723001d4aa6e594f471e1d6c30294d24d50f4957;hpb=d9672fb94b70dac86a6d4fed7ad46a48c5ee4527;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/SQLMaker/LimitDialects.pm b/lib/DBIx/Class/SQLMaker/LimitDialects.pm index 723001d..294c579 100644 --- a/lib/DBIx/Class/SQLMaker/LimitDialects.pm +++ b/lib/DBIx/Class/SQLMaker/LimitDialects.pm @@ -202,7 +202,6 @@ SELECT $out_sel FROM ( EOS - $sql =~ s/\s*\n\s*/ /g; # easier to read in the debugger return $sql; } @@ -307,7 +306,6 @@ EOS EOS } - $sql =~ s/\s*\n\s*/ /g; # easier to read in the debugger return $sql; } @@ -348,7 +346,7 @@ sub _Top { my $inner_order = ($order_by_requested ? $requested_order : [ map - { join ('', $rs_attrs->{alias}, $self->{name_sep}||'.', $_ ) } + { "$rs_attrs->{alias}.$_" } ( $rs_attrs->{_rsroot_source_handle}->resolve->_pri_cols ) ] ); @@ -390,9 +388,9 @@ sub _Top { # since whatever order bindvals there are, they will be realiased # and need to show up in front of the entire initial inner subquery - # Unshift *from_bind* to make this happen (horrible, horrible, but - # we don't have another mechanism yet) - unshift @{$self->{from_bind}}, @{$self->{order_bind}}; + # *unshift* the selector bind stack to make this happen (horrible, + # horrible, but we don't have another mechanism yet) + unshift @{$self->{select_bind}}, @{$self->{order_bind}}; } # and this is order re-alias magic @@ -433,7 +431,6 @@ sub _Top { $order_by_requested, ) if ( ($offset && $order_by_requested) || ($mid_sel ne $out_sel) ); - $sql =~ s/\s*\n\s*/ /g; # easier to read in the debugger return $sql; } @@ -579,7 +576,6 @@ EOS , ); - $sql =~ s/\s*\n\s*/ /g; # easier to read in the debugger return $sql; } @@ -608,10 +604,7 @@ sub _subqueried_limit_attrs { croak 'Limit dialect implementation usable only in the context of DBIC (missing $rs_attrs)' unless ref ($rs_attrs) eq 'HASH'; - my ($re_sep, $re_alias) = map { quotemeta $_ } ( - $self->name_sep || '.', - $rs_attrs->{alias}, - ); + my ($re_sep, $re_alias) = map { quotemeta $_ } ( $self->{name_sep}, $rs_attrs->{alias} ); # correlate select and as, build selection index my (@sel, $in_sel_index); @@ -651,7 +644,11 @@ sub _subqueried_limit_attrs { # for possible further chaining) my (@in_sel, @out_sel, %renamed); for my $node (@sel) { - if (first { $_ =~ / (?{as}, $node->{unquoted_sql}) ) { + if ( + $node->{as} =~ / (?{unquoted_sql} =~ / (?{as} = $self->_unqualify_colname($node->{as}); my $quoted_as = $self->_quote($node->{as}); push @in_sel, sprintf '%s AS %s', $node->{sql}, $quoted_as; @@ -690,8 +687,7 @@ sub _subqueried_limit_attrs { sub _unqualify_colname { my ($self, $fqcn) = @_; - my $re_sep = quotemeta($self->name_sep || '.'); - $fqcn =~ s/ $re_sep /__/xg; + $fqcn =~ s/ \. /__/xg; return $fqcn; }