[Bast-commits] r8940 - SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Mon Mar 8 22:11:55 GMT 2010


Author: ribasushi
Date: 2010-03-08 22:11:55 +0000 (Mon, 08 Mar 2010)
New Revision: 8940

Modified:
   SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract.pm
Log:
Propagate bindtype properly over nested functions

Modified: SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract.pm
===================================================================
--- SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract.pm	2010-03-08 21:12:07 UTC (rev 8939)
+++ SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract.pm	2010-03-08 22:11:55 UTC (rev 8940)
@@ -513,7 +513,13 @@
 
   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 @@
   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) {




More information about the Bast-commits mailing list