The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement

前端 未结 7 2274
终归单人心
终归单人心 2021-01-25 01:53

I have the following exception Caught exception: The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement, please check table and colum

7条回答
  •  闹比i
    闹比i (楼主)
    2021-01-25 02:43

        $dbAdapter = Zend_Db_Table::getDefaultAdapter();
        $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
    
        $version = $dbAdapter->getServerVersion();
    
        if (!is_null($version))
        {
            if (version_compare($version, '5.5', '>=')){
                $credentialTreatment = 'CAST(SHA1(CONCAT(?, salt)) AS CHAR) AND active = 1';
            }else{
                $credentialTreatment = 'SHA1(CONCAT(?, salt)';
            }
        }
    
    
        $authAdapter->setTableName('users')
        ->setIdentityColumn('username')
        ->setCredentialColumn('passwd')
        ->setCredentialTreatment($credentialTreatment);
    
        return $authAdapter;
    

    Please check this

    As of MySQL 5.5.3, the return value is a nonbinary string in the connection character set. Before 5.5.3, the return value is a binary string; see the notes at the beginning of this section about using the value as a nonbinary string.

    It's works for me.

提交回复
热议问题