/** * Checks if particular account exists. * * @param CAccount $oAccount Object instance with prepopulated account properties. * * @return bool */ public function accountExists(CAccount $oAccount) { $bResult = false; if ($this->oConnection->Execute($this->oCommandCreator->accountExistsQuery($oAccount->Email, $oAccount->IncomingMailLogin, 0 < $oAccount->IdAccount ? $oAccount->IdAccount : null))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow && 0 < (int) $oRow->acct_count) { $bResult = true; } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $bResult; }
/** * Returns query-string for checking if particular account exists. * * @param string $sEmail Account email. * @param string $sLogin Account login. * @param int $niExceptAccountId = null Identifier of account wich should be excluded from the search. * * @return string */ public function accountExistsQuery($sEmail, $sLogin, $niExceptAccountId = null) { return parent::accountExistsQuery($sEmail, $sLogin, $niExceptAccountId) . ' LIMIT 1'; }