X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract.pm;h=0ac8fdde3e2e9852b7c001d8701c1ef644110eb1;hb=7642d9ff9bcdacc503079a78cb85c4d44f0b2016;hp=6e090c478a55bfef9b6cebfda051d1d23ee2440c;hpb=974be3fd094d4bc5292c95f8215e55d4e6961aa3;p=dbsrgits%2FSQL-Abstract.git diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 6e090c4..0ac8fdd 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -193,16 +193,9 @@ sub new { $opt{expand} = { -ident => '_expand_ident', - -value => sub { +{ -bind => [ our $Cur_Col_Meta, $_[2] ] } }, - -not => sub { +{ -op => [ 'not', $_[0]->_expand_expr($_[2]) ] } }, - -bool => sub { - my ($self, undef, $v) = @_; - if (ref($v)) { - return $self->_expand_expr($v); - } - puke "-bool => undef not supported" unless defined($v); - return $self->_expand_ident(-ident => $v); - }, + -value => '_expand_value', + -not => '_expand_not', + -bool => '_expand_bool', }; return bless \%opt, $class; @@ -917,6 +910,23 @@ sub _expand_ident { return +{ -ident => \@parts }; } +sub _expand_value { + +{ -bind => [ our $Cur_Col_Meta, $_[2] ] }; +} + +sub _expand_not { + +{ -op => [ 'not', $_[0]->_expand_expr($_[2]) ] }; +} + +sub _expand_bool { + my ($self, undef, $v) = @_; + if (ref($v)) { + return $self->_expand_expr($v); + } + puke "-bool => undef not supported" unless defined($v); + return $self->_expand_ident(-ident => $v); +} + sub _recurse_where { my ($self, $where, $logic) = @_;