From: Matt S Trout Date: Sun, 17 Jul 2011 01:10:22 +0000 (+0000) Subject: handle \@from via DQ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=64cd5feacf4f7850c4fe52a9269cf08251bc80dc;p=dbsrgits%2FSQL-Abstract.git handle \@from via DQ --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index a54dac3..de2bb08 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -11,7 +11,7 @@ use Carp (); use List::Util (); use Scalar::Util (); use Data::Query::Constants qw( - DQ_IDENTIFIER DQ_OPERATOR DQ_VALUE DQ_LITERAL + DQ_IDENTIFIER DQ_OPERATOR DQ_VALUE DQ_LITERAL DQ_JOIN ); #====================================================================== @@ -1215,7 +1215,23 @@ sub _table { my $self = shift; my $from = shift; $self->_SWITCH_refkind($from, { - ARRAYREF => sub {join ', ', map { $self->_quote($_) } @$from;}, + ARRAYREF => sub { + die "Empty FROM list" unless my @f = @$from; + my $dq = { + type => DQ_IDENTIFIER, + elements => [ split /\Q$self->{name_sep}/, shift @f ], + }; + while (my $x = shift @f) { + $dq = { + type => DQ_JOIN, + join => [ $dq, { + type => DQ_IDENTIFIER, + elements => [ split /\Q$self->{name_sep}/, $x ], + } ], + }; + } + $self->_render_dq($dq); + }, SCALAR => sub { $self->_render_dq({ type => DQ_IDENTIFIER,