From: Peter Rabbitson Date: Mon, 8 Mar 2010 22:11:55 +0000 (+0000) Subject: Propagate bindtype properly over nested functions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a7661cfce2ac3fae8df89747eaaf1522f2d6d723;p=scpubgit%2FQ-Branch.git Propagate bindtype properly over nested functions --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index e90208c..3888f65 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -513,7 +513,13 @@ sub _where_func_generic { my ($sql, @bind) = $self->_SWITCH_refkind ($rhs, { SCALAR => sub { - ($self->_convert('?'), $self->_bindtype('xxx', $rhs) ); + puke "Illegal use of top-level '$op'" + unless $self->{_nested_func_lhs}; + + return ( + $self->_convert('?'), + $self->_bindtype($self->{_nested_func_lhs}, $rhs) + ); }, FALLBACK => sub { $self->_recurse_where ($rhs) @@ -648,6 +654,9 @@ sub _where_hashpair_HASHREF { my ($self, $k, $v, $logic) = @_; $logic ||= 'and'; + local $self->{_nested_func_lhs} = $self->{_nested_func_lhs}; + $self->{_nested_func_lhs} ||= $k; + my ($all_sql, @all_bind); for my $orig_op (sort keys %$v) {