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