From: Matt S Trout Date: Thu, 25 Apr 2019 15:01:18 +0000 (+0000) Subject: surface with_recursive as well X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=601ef6617f2df93a7cc6fd3d1be1878394e3a778;p=scpubgit%2FQ-Branch.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}";