First attempt at SQLA2Support
[scpubgit/Q-Branch.git] / lib / DBIx / Class / SQLMaker / SQLA2Support.pm
CommitLineData
5d4463f6 1package DBIx::Class::SQLMaker::SQLA2Support;
2
3use strict;
4use warnings;
5use if $] < '5.010', 'MRO::Compat';
6use mro 'c3';
7use base qw(
8 DBIx::Class::SQLMaker
9 SQL::Abstract::ExtraClauses
10);
11
12sub select {
13 my $self = shift;
14 my ($sql, @bind) = $self->next::method(@_);
15 my (undef, undef, undef, $attrs) = @_;
16 if (my $with = delete $attrs->{with}) {
17 my ($wsql, @wbind) = @{ $self->render_statement({
18 -select => { with => $with }
19 }) };
20 unshift @bind, @wbind;
21 $sql = "${wsql} ${sql}";
22 }
23 return wantarray ? ($sql, @bind) : $sql;
24}
25
261;