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


PHP ConnectionInterface::rollBack方法代码示例

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


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

示例1: applyXml

 /**
  * @param string $xml
  *
  * @return Database
  */
 public function applyXml($xml)
 {
     $this->readDatabase();
     $builder = new QuickBuilder();
     $builder->setPlatform($this->database->getPlatform());
     $builder->setSchema($xml);
     $database = $builder->getDatabase();
     $database->setSchema('migration');
     $database->setPlatform($this->database->getPlatform());
     $diff = DatabaseComparator::computeDiff($this->database, $database);
     if (false === $diff) {
         return null;
     }
     $sql = $this->database->getPlatform()->getModifyDatabaseDDL($diff);
     $this->con->beginTransaction();
     $statements = SqlParser::parseString($sql);
     foreach ($statements as $statement) {
         try {
             $stmt = $this->con->prepare($statement);
             $stmt->execute();
         } catch (\Exception $e) {
             $this->con->rollBack();
             throw new BuildException(sprintf("Can not execute SQL: \n%s\nFrom database: \n%s\n\nTo database: \n%s\n", $statement, $this->database, $database), null, $e);
         }
     }
     $this->con->commit();
     return $database;
 }
开发者ID:a-melnichuk,项目名称:Movies-Demo,代码行数:33,代码来源:MigrationTestCase.php

示例2: forceRollBack

 /**
  * Rollback the whole transaction, even if this is a nested rollback
  * and reset the nested transaction count to 0.
  *
  * @return boolean Whether operation was successful.
  */
 public function forceRollBack()
 {
     $return = true;
     if ($this->nestedTransactionCount) {
         // If we're in a transaction, always roll it back
         // regardless of nesting level.
         $return = $this->connection->rollBack();
         // reset nested transaction count to 0 so that we don't
         // try to commit (or rollback) the transaction outside this scope.
         $this->nestedTransactionCount = 0;
         if ($this->useDebug) {
             $this->log('Rollback transaction');
         }
     }
     return $return;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:22,代码来源:ConnectionWrapper.php

示例3: postActivation

 public function postActivation(ConnectionInterface $con = null)
 {
     $con->beginTransaction();
     try {
         if (null === ConfigQuery::read(static::CONFIG_API_KEY)) {
             $this->createConfigValue(static::CONFIG_API_KEY, ["fr_FR" => "Clé d'API pour mailjet", "en_US" => "Api key for mailjet"]);
         }
         if (null === ConfigQuery::read(static::CONFIG_API_SECRET)) {
             $this->createConfigValue(static::CONFIG_API_SECRET, ["fr_FR" => "Secret d'API pour mailjet", "en_US" => "Api secret for mailjet"]);
         }
         if (null === ConfigQuery::read(static::CONFIG_NEWSLETTER_LIST)) {
             $this->createConfigValue(static::CONFIG_NEWSLETTER_LIST, ["fr_FR" => "ALT de la liste de diffusion mailjet", "en_US" => "Diffusion list ALT of mailjet"]);
         }
         if (null === ConfigQuery::read(static::CONFIG_API_WS_ADDRESS)) {
             $this->createConfigValue(static::CONFIG_API_WS_ADDRESS, ["fr_FR" => "Adresse du webservice mailjet", "en_US" => "Address of the mailjet webservice"], "https://api.mailjet.com/v3/REST");
         }
         $database = new Database($con);
         $database->insertSql(null, [__DIR__ . "/Config/thelia.sql"]);
         $con->commit();
     } catch (\Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
开发者ID:Boyquotes,项目名称:Mailjet,代码行数:24,代码来源:Mailjet.php

示例4: tearDown

 protected function tearDown()
 {
     $this->con->rollBack();
 }
开发者ID:margery,项目名称:thelia,代码行数:4,代码来源:ExportPriceThenImportItTest.php


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