);
}
+ method _in($ast) {
+ my (undef, $field, @values) = @$ast;
+
+ return $self->generate($field) .
+ " IN (" .
+ join(", ", map { $self->generate($_) } @values ) .
+ ")";
+ }
+
method _generic_func(ArrayRef $ast) {
}
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 15;
use Test::Differences;
use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
]
]
), "WHERE me.id = ? AND (me.name > ? OR me.name < ?)", "where clause";
+
+eq_or_diff(
+ [SQL::Abstract->generate(
+ [ -where =>
+ [ -in =>
+ [-name => qw/me id/],
+ [-value => '100' ],
+ [-value => '200' ],
+ [-value => '300' ],
+ ]
+ ]
+ ) ],
+
+ [ "WHERE me.id IN (?, ?, ?)",
+ [ qw/100 200 300/]
+ ],
+
+ "where IN clause");