當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。