2009年8月11日星期二

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

I deleted the post, cause i got the answer, but then i regreated cause it may
help someone in the future. The problem was that i created a table, but by
default it's owner was postgres, which was not the owner of the Database ;)
Thanks anyway for the answer

Ralph Schindler-2 wrote:
>
> 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);
>>
>>
>
>

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

没有评论: