if (ref($expr) eq 'HASH') {
if (keys %$expr > 1) {
$logic ||= 'and';
- return +{ "-${logic}" => [
+ return +{ -op => [
+ $logic,
map $self->_expand_expr_hashpair($_ => $expr->{$_}, $logic),
sort keys %$expr
] };
return (($op eq 'not' ? '('.$final_sql.')' : $final_sql), @bind);
} else {
my @parts = map [ $self->_recurse_where($_) ], @args;
+ my ($final_sql) = map +($op =~ /^(and|or)$/ ? "(${_})" : $_), join(
+ ' '.$self->_sqlcase($final_op).' ',
+ map $_->[0], @parts
+ );
return (
- join(' '.$self->_sqlcase($final_op).' ', map $_->[0], @parts),
+ $final_sql,
map @{$_}[1..$#$_], @parts
);
}
my $sql1 = shift || '';
my $sql2 = shift || '';
+ if (my $profile = $ENV{SQL_ABSTRACT_TEST_TREE_PROFILE}) {
+ my $sqlat = SQL::Abstract::Tree->new(profile => $profile);
+ $_ = $sqlat->format($_) for ($sql1, $sql2);
+ }
+
$tb->${\($tb->in_todo ? 'note' : 'diag')} (
"SQL expressions differ\n"
." got: $sql1\n"