use Data::Dumper;
use Carp;
use Test::Builder;
-use Test::Deep qw(eq_deeply);
our @EXPORT_OK = qw/&is_same_sql_bind &is_same_sql &is_same_bind
&eq_sql_bind &eq_sql &eq_bind
sub eq_bind {
my ($bind_ref1, $bind_ref2) = @_;
- return eq_deeply($bind_ref1, $bind_ref2);
+ local $Data::Dumper::Useqq = 1;
+ local $Data::Dumper::Sortkeys = 1;
+
+ return Dumper($bind_ref1) eq Dumper($bind_ref2);
}
sub eq_sql {
my $right = _recurse_parse($tokens, PARSE_IN_PARENS);
$token = shift @$tokens or croak "missing closing ')' around block " . unparse ($right);
$token eq ')' or croak "unexpected token '$token' terminating block " . unparse ($right);
+
$left = $left ? [@$left, [PAREN => [$right] ]]
: [PAREN => [$right] ];
}
elsif (grep { $token =~ /^ $_ $/xi } @expression_terminator_sql_keywords ) {
my $op = uc $token;
my $right = _recurse_parse($tokens, PARSE_IN_EXPR);
- $left = $left ? [@$left, [$op => [$right] ]]
- : [[ $op => [$right] ]];
+ $left = $left ? [ $left, [$op => [$right] ]]
+ : [ $op => [$right] ];
}
# NOT (last as to allow all other NOT X pieces first)
elsif ( $token =~ /^ not $/ix ) {
my $op = uc $token;
my $right = _recurse_parse ($tokens, PARSE_RHS);
$left = $left ? [ @$left, [$op => [$right] ]]
- : [[ $op => [$right] ]];
+ : [ $op => [$right] ];
}
# literal (eat everything on the right until RHS termination)
else {
my $right = _recurse_parse ($tokens, PARSE_RHS);
- $left = $left ? [$left, [LITERAL => [join ' ', $token, unparse($right)||()] ] ]
+ $left = $left ? [ $left, [LITERAL => [join ' ', $token, unparse($right)||()] ] ]
: [ LITERAL => [join ' ', $token, unparse($right)||()] ];
}
}