本文整理汇总了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());
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例5: delete
/**
* {@inheritdoc}
*/
public function delete()
{
$this->database->truncate('node_access')->execute();
}
示例6: clear
/**
* {@inheritdoc}
*/
public function clear()
{
$this->db->truncate($this->table)->execute();
}
示例7: purge
/**
* {@inheritdoc}
*/
public function purge()
{
$this->database->truncate('webprofiler')->execute();
}
示例8: deleteAll
/**
* {@inheritdoc}
*/
public function deleteAll()
{
$this->database->truncate('url_alias')->execute();
}