当前位置: 首页>>代码示例>>PHP>>正文


PHP AdapterInterface::dropTemporaryTable方法代码示例

本文整理汇总了PHP中Magento\Framework\DB\Adapter\AdapterInterface::dropTemporaryTable方法的典型用法代码示例。如果您正苦于以下问题:PHP AdapterInterface::dropTemporaryTable方法的具体用法?PHP AdapterInterface::dropTemporaryTable怎么用?PHP AdapterInterface::dropTemporaryTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\DB\Adapter\AdapterInterface的用法示例。


在下文中一共展示了AdapterInterface::dropTemporaryTable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _cleanOnFailure

 /**
  * Drop temporary tables created by reindex process
  *
  * @param array $tablesList
  * @param int|string $storeId
  * @return void
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 protected function _cleanOnFailure(array $tablesList, $storeId)
 {
     foreach ($tablesList as $table => $columns) {
         $this->_connection->dropTemporaryTable($table);
     }
     $tableName = $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId));
     $this->_connection->dropTable($tableName);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:AbstractAction.php

示例2: makeTempCategoryTreeIndex

 /**
  * Build and populate the temporary category tree index table
  *
  * Returns the name of the temporary table to use in queries.
  *
  * @return string
  */
 protected function makeTempCategoryTreeIndex()
 {
     // Note: this temporary table is per-connection, so won't conflict by prefix.
     $temporaryName = $this->getTemporaryTreeIndexTableName();
     $temporaryTable = $this->connection->newTable($temporaryName);
     $temporaryTable->addColumn('parent_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'unsigned' => true]);
     $temporaryTable->addColumn('child_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'unsigned' => true]);
     // Each entry will be unique.
     $temporaryTable->addIndex('idx_primary', ['parent_id', 'child_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY]);
     // Drop the temporary table in case it already exists on this (persistent?) connection.
     $this->connection->dropTemporaryTable($temporaryName);
     $this->connection->createTemporaryTable($temporaryTable);
     $this->fillTempCategoryTreeIndex($temporaryName);
     return $temporaryName;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:22,代码来源:AbstractAction.php

示例3: _createTemporaryTable

 /**
  * Create empty temporary table with given columns list
  *
  * @param string $tableName  Table name
  * @param array $columns array('columnName' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute, ...)
  * @param string $valueFieldSuffix
  *
  * @return array
  */
 protected function _createTemporaryTable($tableName, array $columns, $valueFieldSuffix)
 {
     $valueTables = [];
     if (!empty($columns)) {
         $valueTableName = $tableName . $valueFieldSuffix;
         $temporaryTable = $this->_connection->newTable($tableName);
         $valueTemporaryTable = $this->_connection->newTable($valueTableName);
         $flatColumns = $this->_productIndexerHelper->getFlatColumns();
         $temporaryTable->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER);
         $temporaryTable->addColumn('type_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT);
         $temporaryTable->addColumn('attribute_set_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER);
         $valueTemporaryTable->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER);
         /** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
         foreach ($columns as $columnName => $attribute) {
             $attributeCode = $attribute->getAttributeCode();
             if (isset($flatColumns[$attributeCode])) {
                 $column = $flatColumns[$attributeCode];
             } else {
                 $column = $attribute->_getFlatColumnsDdlDefinition();
                 $column = $column[$attributeCode];
             }
             $temporaryTable->addColumn($columnName, $column['type'], isset($column['length']) ? $column['length'] : null);
             $columnValueName = $attributeCode . $valueFieldSuffix;
             if (isset($flatColumns[$columnValueName])) {
                 $columnValue = $flatColumns[$columnValueName];
                 $valueTemporaryTable->addColumn($columnValueName, $columnValue['type'], isset($columnValue['length']) ? $columnValue['length'] : null);
             }
         }
         $this->_connection->dropTemporaryTable($tableName);
         $this->_connection->createTemporaryTable($temporaryTable);
         if (count($valueTemporaryTable->getColumns()) > 1) {
             $this->_connection->dropTemporaryTable($valueTableName);
             $this->_connection->createTemporaryTable($valueTemporaryTable);
             $valueTables[$valueTableName] = $valueTableName;
         }
     }
     return $valueTables;
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:47,代码来源:TableBuilder.php


注:本文中的Magento\Framework\DB\Adapter\AdapterInterface::dropTemporaryTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。