From: Matt S Trout Date: Tue, 12 Feb 2019 18:54:52 +0000 (+0000) Subject: handle scalar arg to _recurse_where correctly X-Git-Tag: v1.90_01~409 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5492d4c241558b72824ff782d35476b3f618a056;p=dbsrgits%2FSQL-Abstract.git handle scalar arg to _recurse_where correctly --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 7270684..f078dc9 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -862,7 +862,11 @@ sub _recurse_where { #print STDERR Data::Dumper::Concise::Dumper([ $where, $logic ]); - my $where_exp = $self->_expand_expr($where, $logic); + # Special case: top level simple string treated as literal + + my $where_exp = (ref($where) + ? $self->_expand_expr($where, $logic) + : { -literal => [ $where ] }); #print STDERR Data::Dumper::Concise::Dumper([ EXP => $where_exp ]); diff --git a/t/02where.t b/t/02where.t index 7c4851b..2a41239 100644 --- a/t/02where.t +++ b/t/02where.t @@ -11,6 +11,12 @@ my $not_stringifiable = bless {}, 'SQLA::NotStringifiable'; my @handle_tests = ( { + where => 'foo', + order => [], + stmt => ' WHERE foo', + bind => [], + }, + { where => { requestor => 'inna', worker => ['nwiger', 'rcwe', 'sfz'],