ZF-7889: Zend_Auth_Adapter_DbTable SQL incompatible with MS SQL Server ZF 1.9

Description

This list states that the problem has been solved, but I continue having problems on accessing the database Sql Server using Zend_Auth. You have the implementation and Exception below.

I would like quoting that the fields on table are correct, I tested them using the database mysql.

  • Exception

  • The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement, please check table and column names for validity.

  • Implementation


$authAdapter = new Zend_Auth_Adapter_DbTable (Zend_Registry::get ( 'database' ), 'user', 'email', 'password', 'SHA1' );
$authAdapter->setIdentity ( '' . $login . '' )->setCredential ( '' . $senha . '' );
$auth = self::getInstance ();
$result = $auth->authenticate ( $authAdapter );
if ($result->isValid ()) { 
$data = $authAdapter->getResultRowObject ( null, 'password' ); 
$auth->getStorage ()->write ( $data ); 
$auth->getIdentity (); 
}

Thanks

Comments

Try changing:


$authAdapter = new Zend_Auth_Adapter_DbTable (Zend_Registry::get ( 'database' ), 'user', 'email', 'password', 'SHA1' );

To


$authAdapter = new Zend_Auth_Adapter_DbTable (Zend_Registry::get ( 'database' ), 'user', 'email', 'password', 'SHA1(?)' );

Fix to user's code was supplied