/**
  * Reindex catalog prices by website for timestamp
  *
  * @param Mage_Core_Model_Website $website
  * @param int $timestamp
  */
 protected function _reindex(Mage_Core_Model_Website $website, $timestamp)
 {
     $this->_createTemporaryTable();
     $this->_connection->query($this->_connection->insertFromSelect($this->_prepareTemporarySelect($website), $this->_getTemporaryTable()));
     $this->_removeOldIndexData($website);
     $this->_fillIndexData($website, $timestamp);
 }
 /**
  * Refresh redirect to url rewrite relations
  *
  * @return Enterprise_UrlRewrite_Model_Index_Action_Url_Rewrite_RefreshAbstract
  */
 protected function _refreshRelation()
 {
     $insert = $this->_connection->insertFromSelect($this->_getRefreshRelationSelectSql(), $this->_relationTableName, $this->_relationColumns);
     $insert .= sprintf(' ON DUPLICATE KEY UPDATE %1$s = VALUES(%1$s)', $this->_connection->quoteIdentifier('url_rewrite_id'));
     $this->_connection->query($insert);
     return $this;
 }
예제 #3
0
 /**
  * Reindex all products to root category
  *
  * @param Mage_Core_Model_Store $store
  */
 protected function _reindexRootCategory(Mage_Core_Model_Store $store)
 {
     $selects = $this->_prepareSelectsByRange($this->_getAllProducts($store), 'entity_id', self::RANGE_PRODUCT_STEP);
     foreach ($selects as $select) {
         $this->_connection->query($this->_connection->insertFromSelect($select, $this->_getMainTmpTable(), array('category_id', 'product_id', 'position', 'is_parent', 'store_id', 'visibility'), Varien_Db_Adapter_Interface::INSERT_IGNORE));
     }
 }
 /**
  * Refresh materialized view
  *
  * @return Enterprise_Mview_Model_Action_Mview_Refresh
  * @throws Exception
  */
 public function execute()
 {
     try {
         $insert = $this->_connection->insertFromSelect($this->_connection->select()->from($this->_metadata->getViewName()), $this->_metadata->getTableName());
         $this->_connection->delete($this->_metadata->getTableName());
         $this->_connection->query($insert);
         $this->_metadata->setValidStatus()->setVersionId($this->_selectLastVersionId())->save();
     } catch (Exception $e) {
         $this->_metadata->setInvalidStatus()->save();
         throw $e;
     }
     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;
 }
 /**
  * Returns insert sql
  *
  * @return string
  */
 public function _getInsertSql()
 {
     return $this->_connection->insertFromSelect($this->_getSelectSql(), $this->_metadata->getTableName());
 }