本文整理汇总了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);
}
示例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;
}
示例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;
}