2009年8月9日星期日

[fw-db] Auth problem (Zend_Auth_Adapter_DbTable failed to produce a valid sql statement,)

Hi there.
Im trying to implement Auth on my project, and everything was going fine
until i start getting a strange error:

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

I have found that this problem happens on file: Zend/Auth/Adapter
on method: _authenticateQuerySelect(Zend_Db_Select $dbSelect)
on line: $resultIdentities =
$this->_zendDb->fetchAll($dbSelect->__toString());

If i dump the $dbSelect->__toString() i get a query like this: "SELECT
"users".*, (CASE WHEN "password" = 'pass' THEN 1 ELSE 0 END) AS
"zend_auth_credential_match" FROM "users" WHERE ("username" = 'name')"

which if i run on pgadmin3 works ok as long as there's a user with username
= 'name'...

Any clue of what the problem might be? Thanks

This is how i set up the code before authenticate:
$dbAdapter = Zend_Db_Table::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('users')
->setIdentityColumn('username')
->setCredentialColumn('password');
$authAdapter->setIdentity($formData['username']);
$authAdapter->setCredential($formData['password']);

$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);


--
View this message in context: http://www.nabble.com/Auth-problem-%28Zend_Auth_Adapter_DbTable-failed-to-produce-a-valid-sql-statement%2C%29-tp24892336p24892336.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: