From: Matt S Trout Date: Thu, 25 Apr 2019 15:01:18 +0000 (+0000) Subject: surface with_recursive as well X-Git-Tag: v2.000000~3^2~175 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=731cd068aca00196faf68b25397a3fc683255cb2;p=dbsrgits%2FSQL-Abstract.git surface with_recursive as well --- diff --git a/lib/DBIx/Class/SQLMaker/SQLA2Support.pm b/lib/DBIx/Class/SQLMaker/SQLA2Support.pm index c35bda9..82f2a16 100644 --- a/lib/DBIx/Class/SQLMaker/SQLA2Support.pm +++ b/lib/DBIx/Class/SQLMaker/SQLA2Support.pm @@ -13,9 +13,10 @@ sub select { my $self = shift; my ($sql, @bind) = $self->next::method(@_); my (undef, undef, undef, $attrs) = @_; - if (my $with = delete $attrs->{with}) { + if (my $with = delete $attrs->{with} or my $wrec = delete $attrs->{with_recursive}) { + die "Can't have with and with_recursive at once" if $with and $wrec; my ($wsql, @wbind) = @{ $self->render_statement({ - -select => { with => $with } + -select => ($with ? { with => $with } : { with_recursive => $wrec }) }) }; unshift @bind, @wbind; $sql = "${wsql} ${sql}";