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


PHP AdapterInterface::isTableExists方法代码示例

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


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

示例1: checkConnection

 /**
  * Check DB connection
  *
  * @return void
  * @throws \Magento\Framework\Exception\SessionException
  */
 protected function checkConnection()
 {
     if (!$this->_write) {
         throw new SessionException(new Phrase('Write DB connection is not available'));
     }
     if (!$this->_write->isTableExists($this->_sessionTable)) {
         throw new SessionException(new Phrase('DB storage table does not exist'));
     }
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:15,代码来源:DbTable.php

示例2: checkConnection

 /**
  * Check DB connection
  *
  * @return void
  * @throws \Magento\Framework\Session\SaveHandlerException
  */
 protected function checkConnection()
 {
     if (!$this->_write) {
         throw new \Magento\Framework\Session\SaveHandlerException('Write DB connection is not available');
     }
     if (!$this->_write->isTableExists($this->_sessionTable)) {
         throw new \Magento\Framework\Session\SaveHandlerException('DB storage table does not exist');
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:DbTable.php

示例3: testCreateAndDrop

 /**
  * Test for create() and drop() methods
  *
  * @return void
  */
 public function testCreateAndDrop()
 {
     /** @var \Magento\Framework\Mview\View\Changelog $model */
     $model = $this->objectManager->create('Magento\\Framework\\Mview\\View\\Changelog', ['resource' => $this->resource]);
     $model->setViewId('test_view_id_2');
     $changelogName = $this->resource->getTableName($model->getName());
     $this->assertFalse($this->connection->isTableExists($changelogName));
     $model->create();
     $this->assertTrue($this->connection->isTableExists($changelogName));
     $model->drop();
     $this->assertFalse($this->connection->isTableExists($changelogName));
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:17,代码来源:ChangelogTest.php

示例4: createDelta

 /**
  * Create delta for specified table
  *
  * @param string $documentName
  * @param string $deltaLogName
  * @param string $idKey
  * @return void
  */
 public function createDelta($documentName, $deltaLogName, $idKey)
 {
     if (!$this->resourceAdapter->isTableExists($deltaLogName)) {
         $triggerTable = $this->resourceAdapter->newTable($deltaLogName)->addColumn($idKey, \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'primary' => true])->addColumn('operation', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT)->addColumn('processed', \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, null, ['nullable' => false, 'default' => 0]);
         $this->resourceAdapter->createTable($triggerTable);
     } else {
         $this->deleteAllRecords($deltaLogName);
     }
     foreach (Trigger::getListOfEvents() as $event) {
         $triggerName = $this->resourceAdapter->getTableName('trg_' . $documentName . '_after_' . strtolower($event));
         $statement = $this->buildStatement($event, $idKey, $deltaLogName);
         $trigger = $this->triggerFactory->create()->setTime(Trigger::TIME_AFTER)->setEvent($event)->setTable($documentName);
         $triggerKey = $documentName . $event . Trigger::TIME_AFTER;
         $triggerExists = $this->isTriggerExist($triggerKey);
         if ($triggerExists) {
             $triggerName = $this->triggers[$triggerKey]['trigger_name'];
             $oldTriggerStatement = $this->triggers[$triggerKey]['action_statement'];
             if (strpos($oldTriggerStatement, $statement) !== false) {
                 unset($trigger);
                 continue;
             }
             $trigger->addStatement($oldTriggerStatement);
             $this->resourceAdapter->dropTrigger($triggerName);
         }
         $trigger->addStatement($statement)->setName($triggerName);
         $this->resourceAdapter->createTrigger($trigger);
         if (!$triggerExists) {
             $this->triggers[$triggerKey] = 1;
         }
         unset($trigger);
     }
 }
开发者ID:victor-v-rad,项目名称:data-migration-tool,代码行数:40,代码来源:Mysql.php

示例5: _isFlatTableExists

 /**
  * Check is flat table for store exists
  *
  * @param int $storeId
  * @return bool
  */
 protected function _isFlatTableExists($storeId)
 {
     if (!isset($this->_flatTablesExist[$storeId])) {
         $tableName = $this->_productIndexerHelper->getFlatTableName($storeId);
         $isTableExists = $this->_connection->isTableExists($tableName);
         $this->_flatTablesExist[$storeId] = $isTableExists ? true : false;
     }
     return $this->_flatTablesExist[$storeId];
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:AbstractAction.php

示例6: getVersion

 /**
  * Get maximum version_id from changelog
  *
  * @return int
  * @throws \Exception
  */
 public function getVersion()
 {
     $changelogTableName = $this->resource->getTableName($this->getName());
     if (!$this->connection->isTableExists($changelogTableName)) {
         throw new \Exception("Table {$changelogTableName} does not exist");
     }
     $row = $this->connection->fetchRow('SHOW TABLE STATUS LIKE ?', [$changelogTableName]);
     if (isset($row['Auto_increment'])) {
         return (int) $row['Auto_increment'] - 1;
     } else {
         throw new \Exception("Table status for `{$changelogTableName}` is incorrect. Can`t fetch version id.");
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:Changelog.php

示例7: dropTable

 /**
  * @param AdapterInterface $connection
  * @param string $tableName
  * @return void
  */
 private function dropTable(AdapterInterface $connection, $tableName)
 {
     if ($connection->isTableExists($tableName)) {
         $connection->dropTable($tableName);
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:IndexStructure.php

示例8: setupFlagTable

 /**
  * Create table 'flag'
  *
  * @param SchemaSetupInterface $setup
  * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
  * @return void
  */
 private function setupFlagTable(
     SchemaSetupInterface $setup,
     \Magento\Framework\DB\Adapter\AdapterInterface $connection
 ) {
     if (!$connection->isTableExists($setup->getTable('flag'))) {
         $table = $connection->newTable(
             $setup->getTable('flag')
         )->addColumn(
             'flag_id',
             \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
             null,
             ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
             'Flag Id'
         )->addColumn(
             'flag_code',
             \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
             255,
             ['nullable' => false],
             'Flag Code'
         )->addColumn(
             'state',
             \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
             null,
             ['unsigned' => true, 'nullable' => false, 'default' => '0'],
             'Flag State'
         )->addColumn(
             'flag_data',
             \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
             '64k',
             [],
             'Flag Data'
         )->addColumn(
             'last_update',
             \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
             null,
             ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
             'Date of Last Flag Update'
         )->addIndex(
             $setup->getIdxName('flag', ['last_update']),
             ['last_update']
         )->setComment(
             'Flag'
         );
         $connection->createTable($table);
     }
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:53,代码来源:Installer.php

示例9: dropTable

 /**
  * @param AdapterInterface $adapter
  * @param string $tableName
  * @return void
  */
 private function dropTable(AdapterInterface $adapter, $tableName)
 {
     if ($adapter->isTableExists($tableName)) {
         $adapter->dropTable($tableName);
     }
 }
开发者ID:nja78,项目名称:magento2,代码行数:11,代码来源:IndexStructure.php


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