X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FQ-Branch.git;a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FExtraClauses.pm;h=27f88f91f056f302e7c99527faf0a75713971e38;hp=91c6179dc199af02fffabce5fcaca8a80e9830c1;hb=41086177ba1f6933a58673c79af6770fba80700e;hpb=51046d0ecdfc1f4cdcfe6151502d17167e41a9be diff --git a/lib/SQL/Abstract/ExtraClauses.pm b/lib/SQL/Abstract/ExtraClauses.pm index 91c6179..27f88f9 100644 --- a/lib/SQL/Abstract/ExtraClauses.pm +++ b/lib/SQL/Abstract/ExtraClauses.pm @@ -98,16 +98,7 @@ sub apply_to { $sqla->renderer($setop => $self->cb('_render_setop')); } - my $setop_expander = $self->cb(sub { - my ($self, $setop, $args) = @_; - my ($op, $type) = split '_', $setop; - +(setop => $self->expand_expr({ - "-${op}" => { - ($type ? (type => $type) : ()), - queries => (ref($args) eq 'ARRAY' ? $args : [ $args ]) - } - })); - }); + my $setop_expander = $self->cb('_expand_clause_setop'); $sqla->clause_expanders( map +($_ => $setop_expander), @@ -343,4 +334,15 @@ sub _render_setop { ); } +sub _expand_clause_setop { + my ($self, $setop, $args) = @_; + my ($op, $type) = split '_', $setop; + +(setop => $self->expand_expr({ + "-${op}" => { + ($type ? (type => $type) : ()), + queries => (ref($args) eq 'ARRAY' ? $args : [ $args ]) + } + })); +} + 1;