2009年8月11日星期二

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

There is a statement exception being throw from the fetchAll(), is there
a way you can check the message from the resulting Exception to see what
the issue is?

-ralph

Ghunti wrote:
> 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);
>
>

没有评论: