<div dir="ltr">Thanks<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 12, 2014 at 5:21 PM, Dagfinn Ilmari Mannsåker <span dir="ltr">&lt;<a href="mailto:ilmari@ilmari.org" target="_blank">ilmari@ilmari.org</a>&gt;</span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Duncan Garland &lt;<a href="mailto:duncan.garland@motortrak.com">duncan.garland@motortrak.com</a>&gt; writes:<br>
<br>
&gt; Hi,<br>
&gt;<br>
&gt;<br>
&gt; Can somebody explain why I&#39;ve started to get this warning when I run the<br>
&gt; statement below.<br>
&gt;<br>
&gt; As far as I can see, I&#39;m doing exactly as asked, and the code works so it<br>
&gt; doesn&#39;t evaluate to 1=1.<br>
<br>
It doesn&#39;t evaluate to literally &quot;1=1&quot;, but by default array refs are<br>
ORed, so it evaluates to &#39;foo != x OR foo != y&#39;, which is always true<br>
if x != y.<br>
<br>
&gt; SQL::Abstract::belch(): [SQL::Abstract::_where_field_op_ARRAYREF] Warning:<br>
&gt; A multi-element arrayref as an argument to the inequality op &#39;!=&#39; is<br>
&gt; technically equivalent to an always-true 1=1 (you probably wanted to say<br>
&gt; ...{ $inequality_op =&gt; [ -and =&gt; @values ] }... instead)<br>
<br>
Note it says @values, not \@values. [ -and =&gt; ... ] and [ -or =&gt; ... ]<br>
only override the operator used between the rest of the values in that<br>
same array, not recursively into contained arrays.<br>
<br>
&gt;   my @service_contracts = $c-&gt;model(&#39;DB::Mbfl2ServiceContract&#39;)-&gt;search(<br>
&gt;     { vehicle_id =&gt; $vehicle_id,<br>
&gt;       deleted_yn =&gt; &#39;N&#39;,<br>
&gt;       status     =&gt; { &#39;!=&#39; =&gt; [ &#39;-and&#39; =&gt; [ &#39;T&#39;, &#39;X&#39;, &#39;E&#39; ] ] }<br>
<br>
If you run this with DBIC_TRACE=1, you&#39;ll see this renders as<br>
<br>
     status != ? OR status != ? OR status != ?<br>
<br>
If you&#39;d had [ -and =&gt; [...], [...] ] you would have seen it more clearly<br>
<br>
    (status != ? OR status != ?) AND (status != ? OR status != ?)<br>
<br>
What you actually want is:<br>
<br>
        status     =&gt; { &#39;!=&#39; =&gt; [ &#39;-and&#39; =&gt; &#39;T&#39;, &#39;X&#39;, &#39;E&#39; ] }<br>
<br>
Which renders as<br>
<br>
    status != ? AND status != ? AND status != ?<br>
<br>
Hope this clarifies things.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
&quot;The surreality of the universe tends towards a maximum&quot; -- Skud&#39;s Law<br>
&quot;Never formulate a law or axiom that you&#39;re not prepared to live with<br>
 the consequences of.&quot;                              -- Skud&#39;s Meta-Law<br>
<br>
<br>
_______________________________________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a><br>
IRC: <a href="http://irc.perl.org#dbix-class" target="_blank">irc.perl.org#dbix-class</a><br>
SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" target="_blank">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a><br>
Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a><br>
</font></span></blockquote></div></div>

<br>
<font face="Arial" size="1" style="color:rgb(34,34,34);background-color:rgb(255,255,255)"><font color="#808080">The information contained in this message is for the intended addressee only and may contain confidential and/or privileged information. If you are not the intended addressee, please delete this message and notify the sender; do not copy or distribute this message or disclose its contents to anyone. Any views or opinions expressed in this message are those of the author and do not necessarily represent those of Motortrak Limited or of any of its associated companies. No reliance may be placed on this message without written confirmation from an authorised representative of the company.</font></font><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)"><font color="#808080"><font face="Arial" size="1"><br>Registered in England 3098391 V.A.T. Registered No. 667463890</font></font></div>