From: Matt S Trout Date: Thu, 2 May 2019 19:03:05 +0000 (+0000) Subject: it would help if I actually enabled with for non-select statements X-Git-Tag: v1.90_01~153 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a97ecd95f2256f8e86c370fb19c570aa013cbf89;p=dbsrgits%2FSQL-Abstract.git it would help if I actually enabled with for non-select statements --- diff --git a/lib/SQL/Abstract/ExtraClauses.pm b/lib/SQL/Abstract/ExtraClauses.pm index 0be3021..2dafda1 100644 --- a/lib/SQL/Abstract/ExtraClauses.pm +++ b/lib/SQL/Abstract/ExtraClauses.pm @@ -153,7 +153,7 @@ sub register_defaults { return +(with => { ($type ? (type => $type) : ()), queries => \@exp }); }); $self->clause_expander('select.with_recursive', $with_expander); - $self->clause_renderer('select.with' => sub { + $self->clause_renderer('select.with' => my $with_renderer = sub { my ($self, undef, $with) = @_; my $q_part = $self->join_query_parts(', ', map { @@ -170,6 +170,12 @@ sub register_defaults { $q_part, ); }); + foreach my $stmt (qw(insert update delete)) { + $self->clauses_of($stmt => 'with', $self->clauses_of($stmt)); + $self->clause_expander("${stmt}.$_", $with_expander) + for qw(with with_recursive); + $self->clause_renderer("${stmt}.with", $with_renderer); + } return $self; }