From: Matt S Trout Date: Mon, 16 Apr 2012 19:57:48 +0000 (+0000) Subject: move _count_subq_rs having recursion to dq X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1609f3b133613b3550668925c5d5bebae0c1163e;p=dbsrgits%2FDBIx-Class-Historic.git move _count_subq_rs having recursion to dq --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 5434e1f..2acafa9 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1652,31 +1652,23 @@ sub _count_subq_rs { # having often contains scalarrefs - thus parse it out entirely my @parts = @$g; if ($attrs->{having}) { - local $sql_maker->{having_bind}; - local $sql_maker->{quote_char} = $sql_maker->{quote_char}; - local $sql_maker->{name_sep} = $sql_maker->{name_sep}; - unless (defined $sql_maker->{quote_char} and length $sql_maker->{quote_char}) { - $sql_maker->{quote_char} = [ "\x00", "\xFF" ]; - # if we don't unset it we screw up retarded but unfortunately working - # 'MAX(foo.bar)' => { '>', 3 } - $sql_maker->{name_sep} = ''; - } - - my ($lquote, $rquote, $sep) = map { quotemeta $_ } ($sql_maker->_quote_chars, $sql_maker->name_sep); - - my $sql = $sql_maker->_parse_rs_attrs ({ having => $attrs->{having} }); + my $having_dq = $self->_sqla_converter->_where_to_dq($attrs->{having}); + $self->_scan_identifiers( + sub { push @parts, join('.', @{$_[0]->{elements}}) }, + $having_dq + ); # search for both a proper quoted qualified string, for a naive unquoted scalarref # and if all fails for an utterly naive quoted scalar-with-function - while ($sql =~ / - $rquote $sep $lquote (.+?) $rquote - | - [\s,] \w+ \. (\w+) [\s,] - | - [\s,] $lquote (.+?) $rquote [\s,] - /gx) { - push @parts, ($1 || $2 || $3); # one of them matched if we got here - } + #while ($sql =~ / + # $rquote $sep $lquote (.+?) $rquote + # | + # [\s,] \w+ \. (\w+) [\s,] + # | + # [\s,] $lquote (.+?) $rquote [\s,] + #/gx) { + # push @parts, ($1 || $2 || $3); # one of them matched if we got here + #} } for (@parts) {