/** * get the basic select object to fetch records from the database * * @param array|string|Zend_Db_Expr $_cols columns to get, * per default * @param boolean $_getDeleted get deleted records (if modlog is active) * @return Zend_Db_Select */ protected function _getSelect($_cols = '*', $_getDeleted = FALSE) { $select = $this->_db->select()->from($this->_userTable); if ($this->_hasTine20Userid === true) { $select->where($this->_db->quoteIdentifier($this->_propertyMapping['emailGID']) . ' = ?', $this->_config['emailGID'])->limit(1); } else { $select->where($this->_db->quoteIdentifier($this->_propertyMapping['emailGID']) . ' = ?', $this->_convertToInt($this->_config['emailGID']))->limit(1); } return $select; }
/** * check if user exists already in dovecot user table * * @param Tinebase_Model_FullUser $_user */ protected function _userExists(Tinebase_Model_FullUser $_user) { $select = $this->_getSelect(); $select->where($this->_db->quoteIdentifier($this->_userTable . '.' . $this->_propertyMapping['emailUserId']) . ' = ?', $_user->getId()); #if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $select->__toString()); // Perferom query - retrieve user from database $stmt = $this->_db->query($select); $queryResult = $stmt->fetch(); $stmt->closeCursor(); if (!$queryResult) { return false; } return true; }