title: zend framework 2 autentification using DbTable failure
body: <p>I have followed the <a href="http://packages.zendframework.com/docs/latest/manual/en/modules/zend.authentication.adapter.dbtable.html" rel="nofollow">zend instructions</a> for implement my web Authentication using a database table.</p>
  
  <p>It's exactly the same code, but when render the page, the following exceptions appears:</p>
  
  <pre><code>    Zend\Authentication\Adapter\Exception\RuntimeException
      File:
      C:\xampp\htdocs\pfc\vendor\ZF2\library\Zend\Authentication\Adapter\DbTable.php
      Mensaje:
      The supplied parameters to DbTable failed to produce a valid sql statement, please
      check table and column names for validity.
  </code></pre>
  
  <p>produced by this other:</p>
  
  <pre><code>    Zend\Db\Adapter\Exception\InvalidQueryException
      File:
      C:\xampp\htdocs\pfc\vendor\ZF2\library\Zend\Db\Adapter\Driver\Mysqli\Statement.php
      Mensaje:
      Statement couldn't be produced with sql: SELECT `users`.*, (CASE WHEN `password` = ?
      THEN 1 ELSE 0 END) AS `zend_auth_credential_match` FROM `users` WHERE `mail` = ?
  </code></pre>
  
  <p>Seems to be that Statement.php can not execute the sql of above, but I send the sql by phpmyadmin replacing the ? for strings and work ok.</p>
  
  <p>I am sure that $dbAdapter works ok also because I have tested it and the columns name are 
  "mail" and "password".</p>
  
  <p>This in my code, also I put the $dbAdapter test code.</p>
  
  <pre><code>    $dbAdapter = new DbAdapter(array(   //This DbAdapter Work ok sure!!
          'driver' =&gt; 'Mysqli',
          'database' =&gt; 'securedraw',
          'username' =&gt; 'root',
          'password' =&gt; ''
      ));
  
      $fp = function($name) use ($dbAdapter) { return $dbAdapter-&gt;driver-&gt;formatParameterName($name);};
      $sql = 'SELECT * FROM ' . $qi('users') . ' WHERE id = ' . $fp('id');
      $statement = $dbAdapter-&gt;query($sql);
      $parameters = array('id' =&gt; 1);
      $sqlResult = $statement-&gt;execute($parameters);
      $row = $sqlResult-&gt;current();
      $mail = $row['mail'];
      $password = $row['password'];  //until here test $dbAdapter exitly!!
  
      //Start the auth proccess!!
      $authAdapter = new AuthDbTableAdapter($dbAdapter);
      $authAdapter-&gt;setTableName('users')
      -&gt;setIdentityColumn('mail')
      -&gt;setCredentialColumn('password');
      $authAdapter-&gt;setIdentity('josep')
      -&gt;setCredential('josep');
      $authResult = $authAdapter-&gt;authenticate();   //This is the fail method!!!
  </code></pre>