Esempio n. 1
0
 /**
  * Refresh row of materialized view
  *
  * @param $value
  * @throws Exception
  * @throws Exception
  */
 public function refreshRow($value)
 {
     if (!$this->getMviewName() || !$this->getViewName() || !$this->getRuleColumn() || !$value) {
         throw new Exception('Cann\'t refresh row of materialized view, because metadata doesn\'t contains enough information!!');
     }
     try {
         $this->_commandFactory->getCommandRefreshRow($this->getMviewName(), $this->getViewName(), $this->getRuleColumn(), $value)->execute();
     } catch (Exception $e) {
         $this->setStatus(self::MVIEW_STATUS_INVALID)->save();
         throw $e;
     }
 }
Esempio n. 2
0
 /**
  * Create new materialized view
  *
  * @param $mviewName
  * @param Zend_Db_Select $select
  * @return Mage_Mview_Model_Mview
  */
 public function create($mviewName, Zend_Db_Select $select)
 {
     $mview = $this->_factory->getModel('mview/mview', array('factory' => $this->_factory))->setMviewName($mviewName);
     $this->_commandFactory->getCommandCreate($select, $mview->getMviewName(), $mview->getViewName())->execute();
     return $mview->setRefreshedAt(now())->setStatus(Mage_Mview_Model_Mview::MVIEW_STATUS_VALID)->save();
 }