最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Drupal db_transaction 使用范式详解
时间:2022-06-24 22:44:42 编辑:袖梨 来源:一聚教程网
$transaction = isset($transaction) ? $transaction : db_transaction();
try {
$ids = array_keys($entities);
db_delete($this->entityInfo['base table'])
->condition($this->idKey, $ids, 'IN')
->execute();
if (isset($this->revisionTable)) {
db_delete($this->revisionTable)
->condition($this->idKey, $ids, 'IN')
->execute();
}
// Reset the cache as soon as the changes have been applied.
$this->resetCache($ids);
foreach ($entities as $id => $entity) {
$this->invoke('delete', $entity);
}
// Ignore slave server temporarily.
db_ignore_slave();
}
catch (Exception $e) {
$transaction->rollback();
watchdog_exception($this->entityType, $e);
throw $e;
}
以上代码片段为使用db_transaction范式。摘抄自entity模块。
相关文章
- 端午节微信营销活动怎么做 07-13
- Robinhood扩展加密货币服务,在美国推出以太坊和Solana质押功能 07-13
- 如何查看浏览器对html5的支持情况 07-13
- MiningToken vs. ECOS vs. Binance:哪款免费比特币云挖矿应用能带来最高收益?(2025年对比) 07-13
- 誓言唯美句子 07-13
- 逆水寒手游素问修行怎么加点-素问修行加点推荐 07-13