}
method _join(ArrayRef $ast) {
-
+ my (undef, @items) = @$ast;
+
+ croak "invalid component in JOIN: $_" unless ArrayRef->check($items[0]);
+ my @output = 'JOIN';
+
+ # TODO: Validation of inputs
+ return 'JOIN '. $self->dispatch(shift @items) .
+ ' ON (' .
+ $self->_recurse_where( \@items ) . ')';
+
}
method _list(ArrayRef $ast) {
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+use Test::Differences;
+
+use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
+
+my $sqla = SQL::Abstract->create(1);
+
+is $sqla->dispatch(
+ [ -join =>
+ [-name => qw/foo/],
+ [ '==', [-name => qw/foo id/], [ -name => qw/me foo_id/ ] ]
+ ]
+), "JOIN foo ON (foo.id = me.foo_id)",
+ "simple join clause";
+