From: Dagfinn Ilmari Mannsåker Date: Mon, 28 Jul 2014 15:33:52 +0000 (+0100) Subject: Use proper quote handling in _count_subq_rs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=140873ef6dc1877d09fdca235994185504c2f8da Use proper quote handling in _count_subq_rs --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 9a478e4..c82711a 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1730,7 +1730,8 @@ sub _count_subq_rs { $sql_maker->{name_sep} = ''; } - my ($lquote, $rquote, $sep) = map { quotemeta $_ } ($sql_maker->_quote_chars, $sql_maker->name_sep); + my $sep = quotemeta($sql_maker->name_sep); + my $ident_re = $sql_maker->_quoted_ident_re; my $having_sql = $sql_maker->_parse_rs_attrs ({ having => $attrs->{having} }); my %seen_having; @@ -1738,13 +1739,13 @@ sub _count_subq_rs { # 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 ($having_sql =~ / - $rquote $sep $lquote (.+?) $rquote + $ident_re $sep ($ident_re) | [\s,] \w+ \. (\w+) [\s,] | - [\s,] $lquote (.+?) $rquote [\s,] + [\s,] ($ident_re) [\s,] /gx) { - my $part = $1 || $2 || $3; # one of them matched if we got here + my $part = $sql_maker->_unquote($1 || $2 || $3); # one of them matched if we got here unless ($seen_having{$part}++) { push @parts, $part; }