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


PHP Connection::beginTransaction方法代码示例

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


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

示例1: setUp

 /**
  * Setup database
  */
 protected function setUp()
 {
     parent::setUp();
     \Tester\Helpers::lock('db', dirname(TEMP_DIR));
     $this->connection = $this->getConnection();
     $this->selectionFactory = $this->getSelectionFactory();
     $this->connection->beginTransaction();
     $this->emptyDatabase();
     $this->createDatabase();
     $this->connection->commit();
 }
开发者ID:drahak,项目名称:oauth2,代码行数:14,代码来源:DatabaseTestCase.php

示例2: begin

 /**
  * Begin transaction. Save current save point.
  *
  * @throws InvalidTransactionException
  */
 public function begin()
 {
     if (self::$level === 0 || !$this->isSupported()) {
         $this->connection->beginTransaction();
     } else {
         $this->connection->getPdo()->exec('SAVEPOINT LEVEL' . self::$level);
     }
     self::$level++;
 }
开发者ID:minetro,项目名称:ntdb,代码行数:14,代码来源:Transaction.php

示例3: parse

 /**
  * Parse
  *
  * @param int $dayLimit parse day limit
  */
 public function parse($dayLimit = NULL)
 {
     $date = new DateTime($this->startDate);
     if (empty($dayLimit)) {
         $this->totalDays = (int) ((time() - $date->getTimestamp()) / 86400) + 1;
     } else {
         $this->totalDays = $dayLimit;
     }
     $myDate = new DateTime();
     $parsetime = $myDate->sub(new DateInterval("P2D"))->getTimestamp();
     unset($myDate);
     $this->parsedDays = 1;
     do {
         if ($dayLimit !== NULL && $this->totalDays < $this->parsedDays || $date->getTimestamp() > time()) {
             break;
         }
         if (!defined('STDIN') && !$this->debug) {
             //Next code is realy FUCKING hack
             echo $date->format("Y-m-d") . "<br>\n";
             @ob_end_flush();
             @ob_flush();
             @flush();
             @ob_start();
         }
         $this->connection->beginTransaction();
         $selection = $this->connection->table('parsed');
         if ($selection->where("date = ?", $date->format("Y-m-d"))->count('*') < 1 || $date->getTimestamp() > $parsetime) {
             $this->parseDate($date->format("Y-m-d"));
             $selection->insert(array('date' => $date->format("Y-m-d")));
             $this->parsedDays++;
         } elseif ($dayLimit === NULL) {
             $this->parsedDays++;
         }
         $this->connection->commit();
     } while ($date->add(new DateInterval('P1D'))->getTimestamp() < time());
 }
开发者ID:Vrtak-CZ,项目名称:NJLogParser,代码行数:41,代码来源:Parser.php

示例4: beginTransaction

 /** @return void */
 public function beginTransaction()
 {
     $this->connection->beginTransaction();
 }
开发者ID:vladimirslevercz,项目名称:alena,代码行数:5,代码来源:Context.php

示例5: begin

 /** @return void */
 public function begin()
 {
     if (self::$transactionCounter[$this->getDsnKey()]++ === 0) {
         $this->connection->beginTransaction();
     }
 }
开发者ID:uestla,项目名称:easyblog,代码行数:7,代码来源:Transaction.php


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