_autologinCode)) { $dbSelect = clone $this->getDbSelect(); $dbSelect->from($this->_tableName, array('*', new Zend_Db_Expr('1 AS `zend_auth_credential_match`'))) ->where($this->_zendDb->quoteIdentifier($this->_autologinColumn, true) . ' = ?', $this->_autologinCode) ->where('`active` = ?', 'y') ->limit(1); } else { // build credential expression if (empty($this->_credentialTreatment) || (strpos($this->_credentialTreatment, '?') === false)) { $this->_credentialTreatment = '?'; } $credentialExpression = new Zend_Db_Expr( '(CASE WHEN ' . $this->_zendDb->quoteInto( $this->_zendDb->quoteIdentifier($this->_credentialColumn, true) . ' = ' . $this->_credentialTreatment, $this->_credential ) . ' THEN 1 ELSE 0 END) AS ' . $this->_zendDb->quoteIdentifier( $this->_zendDb->foldCase('zend_auth_credential_match') ) ); // get select $dbSelect = clone $this->getDbSelect(); $dbSelect->from($this->_tableName, array('*', $credentialExpression)) ->where($this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?', $this->_identity) ->where('`active` = ?', 'y'); } return $dbSelect; } }