title: mysql autocasting string to integer
body: <p>my question is a general question:</p>
  
  <p>doctrine treats</p>
  
  <p><code>$entitity-&gt;getTest()-&gt;clear();</code></p>
  
  <p>into this sql query:</p>
  
  <pre><code>DELETE FROM test WHERE test_id = '6'
  </code></pre>
  
  <p>-> test_id is an integer in the database, mysql converts automatic the value so it works.
  but the right query would be :</p>
  
  <pre><code>    DELETE FROM test WHERE test_id = 6
  </code></pre>
  
  <p>I found some Diskussions here:</p>
  
  <p>stackoverflow.com/questions/21762075/mysql-automatically-cast-convert-a-string-to-a-number</p>
  
  <p>code.openark.org/blog/mysql/implicit-casting-you-dont-want-to-see-around</p>
  
  <p>mysql doc says:</p>
  
  <p><a href="http://dev.mysql.com/doc/refman/5.5/en/type-conversion.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/type-conversion.html</a></p>
  
  <blockquote>
    <p>"The following rules describe how conversion occurs for comparison operations" (..) In all other cases, the arguments are compared as floating-point (real) numbers.</p>
  </blockquote>
  
  <p>The Documentation also tells an issue with it:</p>
  
  <blockquote>
    <p>Comparisons that use floating-point numbers (or values that are converted to floating-point numbers) are approximate because such numbers are inexact. This might lead to results that appear inconsistent</p>
  </blockquote>
  
  <p>So why doctrine orm and also dbal acts so? Is this not a problem with tables with integers? only with bigint? </p>
  
  <p>Also look here:</p>
  
  <p><a href="http://www.cubrid.org/cubrid_implicit_type_conversion" rel="nofollow">http://www.cubrid.org/cubrid_implicit_type_conversion</a></p>
  
  <p>-> There it tells that this is not a Problem.</p>
  
  <p>So my question is: Do a query with where int_val = '1' (string) is no big deal or can this be dangerous. if this is dangerous, haste doctrine a design issue here?</p>