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


PHP IDBConnection::rollBack方法代码示例

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


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

示例1: updateOwners

 /**
  * update database with the new owners
  *
  * @param array $owners
  * @throws \Exception
  */
 private function updateOwners($owners)
 {
     $this->connection->beginTransaction();
     try {
         foreach ($owners as $id => $owner) {
             $query = $this->connection->getQueryBuilder();
             $query->update($this->table)->set('parent', $query->createNamedParameter(null))->set('uid_owner', $query->createNamedParameter($owner['owner']))->set('uid_initiator', $query->createNamedParameter($owner['initiator']))->where($query->expr()->eq('id', $query->createNamedParameter($id)))->execute();
         }
         $this->connection->commit();
     } catch (\Exception $e) {
         $this->connection->rollBack();
         throw $e;
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:20,代码来源:migration.php

示例2: migrate

 private function migrate(LegacyStoragesService $legacyService, StoragesService $storageService)
 {
     $existingStorage = $legacyService->getAllStorages();
     $this->connection->beginTransaction();
     try {
         foreach ($existingStorage as $storage) {
             $storageService->addStorage($storage);
         }
         $this->connection->commit();
     } catch (\Exception $e) {
         $this->logger->logException($e);
         $this->connection->rollBack();
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:14,代码来源:storagemigrator.php

示例3: migrate

 private function migrate(LegacyStoragesService $legacyService, StoragesService $storageService)
 {
     $existingStorage = $legacyService->getAllStorages();
     $this->connection->beginTransaction();
     try {
         foreach ($existingStorage as $storage) {
             $mountOptions = $storage->getMountOptions();
             if (!empty($mountOptions) && !isset($mountOptions['enable_sharing'])) {
                 // existing mounts must have sharing enabled by default to avoid surprises
                 $mountOptions['enable_sharing'] = true;
                 $storage->setMountOptions($mountOptions);
             }
             $storageService->addStorage($storage);
         }
         $this->connection->commit();
     } catch (\Exception $e) {
         $this->logger->logException($e);
         $this->connection->rollBack();
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:20,代码来源:StorageMigrator.php

示例4: rollBack

 /**
  * Rollback the database changes done during a transaction that is in progress
  */
 public function rollBack()
 {
     $this->connection->rollBack();
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:7,代码来源:db.php


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