From: Peter Rabbitson Date: Fri, 26 Sep 2014 01:56:45 +0000 (+0200) Subject: Whatever I was thinking it wasn't making much sense X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=52ce7dca90a7626ea18d6c6030ae8f803cdafeb9;p=scpubgit%2FQ-Branch.git Whatever I was thinking it wasn't making much sense Good thing I started pondering how to port this to DQ, otherwise would not have noticed I fucked up... for a while --- diff --git a/Changes b/Changes index c78b007..da25766 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for SQL::Abstract + - Fix erroneous behavior of is_literal_value($) wrt { -ident => ... } + revision 1.79 2014-09-25 ---------------------------- - New exportable functions: is_literal_value($) and is_plain_value($) diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 84499ec..0737656 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -78,11 +78,6 @@ sub puke (@) { sub is_literal_value ($) { ref $_[0] eq 'SCALAR' ? [ ${$_[0]} ] : ( ref $_[0] eq 'REF' and ref ${$_[0]} eq 'ARRAY' ) ? [ @${ $_[0] } ] - : ( - ref $_[0] eq 'HASH' and keys %{$_[0]} == 1 - and - defined $_[0]->{-ident} and ! length ref $_[0]->{-ident} - ) ? [ $_[0]->{-ident} ] : undef; } @@ -2233,8 +2228,6 @@ module: =item * C<\[ $sql_string, @bind_values ]> -=item * C<< { -ident => $plain_defined_string } >> - =back On failure returns C, on sucess returns an B reference diff --git a/t/23_is_X_value.t b/t/23_is_X_value.t index b06501e..c43b3a3 100644 --- a/t/23_is_X_value.t +++ b/t/23_is_X_value.t @@ -229,15 +229,15 @@ for (undef, { -value => undef }) { } is_deeply - is_literal_value { -ident => 'foo' }, - [ 'foo' ], - '-ident recognized as literal' + is_literal_value \'sql', + [ 'sql' ], + 'literal correctly recognized and unpacked' ; is_deeply is_literal_value \[ 'sql', 'bind1', [ {} => 'bind2' ] ], [ 'sql', 'bind1', [ {} => 'bind2' ] ], - 'literal correctly unpacked' + 'literal with binds correctly recognized and unpacked' ;