當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::truncate方法代碼示例

本文整理匯總了PHP中Drupal\Core\Database\Connection::truncate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::truncate方法的具體用法?PHP Connection::truncate怎麽用?PHP Connection::truncate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Database\Connection的用法示例。


在下文中一共展示了Connection::truncate方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $_SESSION['dblog_overview_filter'] = array();
     $this->connection->truncate('watchdog')->execute();
     drupal_set_message($this->t('Database log cleared.'));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
開發者ID:eigentor,項目名稱:tommiblog,代碼行數:10,代碼來源:DblogClearLogConfirmForm.php

示例2: deleteAll

 /**
  * Implements Drupal\Core\Cache\CacheBackendInterface::deleteAll().
  */
 public function deleteAll()
 {
     try {
         $this->connection->truncate($this->bin)->execute();
     } catch (\Exception $e) {
         // Create the cache table, which will be empty. This fixes cases during
         // core install where a cache table is cleared before it is set
         // with {cache_render} and {cache_data}.
         if (!$this->ensureBinExists()) {
             $this->catchException($e);
         }
     }
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:16,代碼來源:DatabaseBackend.php

示例3: deleteAllIndexItems

 /**
  * {@inheritdoc}
  */
 public function deleteAllIndexItems(IndexInterface $index)
 {
     try {
         foreach ($this->configuration['field_tables'][$index->id()] as $field) {
             $this->database->truncate($field['table'])->execute();
         }
         $this->database->truncate($this->configuration['index_tables'][$index->id()])->execute();
     } catch (\Exception $e) {
         // The database operations might throw PDO or other exceptions, so we catch
         // them all and re-wrap them appropriately.
         throw new SearchApiException($e->getMessage(), $e->getCode(), $e);
     }
 }
開發者ID:alexku,項目名稱:travisintegrationtest,代碼行數:16,代碼來源:Database.php

示例4: deleteAllIndexItems

 /**
  * {@inheritdoc}
  */
 public function deleteAllIndexItems(IndexInterface $index)
 {
     try {
         $db_info = $this->getIndexDbInfo($index);
         foreach ($db_info['field_tables'] as $field) {
             $this->database->truncate($field['table'])->execute();
         }
         $this->database->truncate($db_info['index_table'])->execute();
     } catch (\Exception $e) {
         // The database operations might throw PDO or other exceptions, so we
         // catch them all and re-wrap them appropriately.
         throw new SearchApiException($e->getMessage(), $e->getCode(), $e);
     }
 }
開發者ID:curveagency,項目名稱:intranet,代碼行數:17,代碼來源:Database.php

示例5: delete

 /**
  * {@inheritdoc}
  */
 public function delete()
 {
     $this->database->truncate('node_access')->execute();
 }
開發者ID:brstde,項目名稱:gap1,代碼行數:7,代碼來源:NodeGrantDatabaseStorage.php

示例6: clear

 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     $this->db->truncate($this->table)->execute();
 }
開發者ID:nishantkumar155,項目名稱:drupal8.crackle,代碼行數:7,代碼來源:IndexerBase.php

示例7: purge

 /**
  * {@inheritdoc}
  */
 public function purge()
 {
     $this->database->truncate('webprofiler')->execute();
 }
開發者ID:ABaldwinHunter,項目名稱:durhamatletico-cms,代碼行數:7,代碼來源:DatabaseProfilerStorage.php

示例8: deleteAll

 /**
  * {@inheritdoc}
  */
 public function deleteAll()
 {
     $this->database->truncate('url_alias')->execute();
 }
開發者ID:eric-shell,項目名稱:eric-shell-d8,代碼行數:7,代碼來源:AliasStorageHelper.php


注:本文中的Drupal\Core\Database\Connection::truncate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。