/** * Set changelog valid and update version id into metedata * * @return Enterprise_Index_Model_Action_Abstract */ protected function _updateMetadata() { if ($this->_metadata->getStatus() == Enterprise_Mview_Model_Metadata::STATUS_IN_PROGRESS) { $this->_metadata->setValidStatus(); } $this->_metadata->setVersionId($this->_getLastVersionId())->save(); return $this; }
/** * Set changelog valid * * @return Enterprise_Index_Model_Action_Abstract */ protected function _setChangelogValid() { $this->_metadata->load($this->_metadata->getId()); if ($this->_metadata->getStatus() == Enterprise_Mview_Model_Metadata::STATUS_IN_PROGRESS) { $this->_metadata->setValidStatus(); } $this->_metadata->setVersionId($this->_getCurrentVersionId())->save(); return $this; }
/** * Refresh rows by ids from changelog * * @return Enterprise_Mview_Model_Action_Mview_Refresh_Changelog * @throws Enterprise_Mview_Exception */ public function execute() { $this->_validate(); $this->_connection->beginTransaction(); try { $this->_connection->delete($this->_metadata->getTableName(), array($this->_metadata->getKeyColumn() . ' IN ( ' . $this->_selectChangedIds() . ' )')); $this->_connection->query($this->_connection->insertFromSelect($this->_selectChangedRows(), $this->_metadata->getTableName())); $this->_metadata->setVersionId($this->_selectLastVersionId()); $this->_metadata->save(); $this->_connection->commit(); } catch (Exception $e) { $this->_connection->rollBack(); $this->_metadata->setOutOfDateStatus()->save(); throw new Enterprise_Mview_Exception($e->getMessage(), $e->getCode()); } return $this; }