Commit | Line | Data |
5d4463f6 |
1 | package DBIx::Class::SQLMaker::SQLA2Support; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use if $] < '5.010', 'MRO::Compat'; |
6 | use mro 'c3'; |
7 | use base qw( |
8 | DBIx::Class::SQLMaker |
9 | SQL::Abstract::ExtraClauses |
10 | ); |
11 | |
12 | sub select { |
13 | my $self = shift; |
14 | my ($sql, @bind) = $self->next::method(@_); |
15 | my (undef, undef, undef, $attrs) = @_; |
601ef661 |
16 | if (my $with = delete $attrs->{with} or my $wrec = delete $attrs->{with_recursive}) { |
17 | die "Can't have with and with_recursive at once" if $with and $wrec; |
5d4463f6 |
18 | my ($wsql, @wbind) = @{ $self->render_statement({ |
601ef661 |
19 | -select => ($with ? { with => $with } : { with_recursive => $wrec }) |
5d4463f6 |
20 | }) }; |
21 | unshift @bind, @wbind; |
22 | $sql = "${wsql} ${sql}"; |
23 | } |
24 | return wantarray ? ($sql, @bind) : $sql; |
25 | } |
26 | |
27 | 1; |