當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::commit方法代碼示例

本文整理匯總了PHP中Nette\Database\Connection::commit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::commit方法的具體用法?PHP Connection::commit怎麽用?PHP Connection::commit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Database\Connection的用法示例。


在下文中一共展示了Connection::commit方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: commit

 /** @return void */
 public function commit()
 {
     if (self::$transactionCounter[$dsn = $this->getDsnKey()] === 0) {
         throw new Exception\InvalidStateException('No transaction started.');
     }
     if (--self::$transactionCounter[$dsn] === 0) {
         $this->connection->commit();
     }
 }
開發者ID:uestla,項目名稱:easyblog,代碼行數:10,代碼來源:Transaction.php

示例2: 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

示例3: commit

 /**
  * Commit transaction. Release current save point.
  *
  * @return void
  * @throws InvalidTransactionException
  */
 public function commit()
 {
     if (self::$level === 0) {
         throw new InvalidTransactionException('No transaction started');
     }
     self::$level--;
     if (self::$level === 0 || !$this->isSupported()) {
         $this->connection->commit();
     } else {
         $this->connection->getPdo()->exec('RELEASE SAVEPOINT LEVEL' . self::$level);
     }
 }
開發者ID:minetro,項目名稱:ntdb,代碼行數:18,代碼來源:Transaction.php

示例4: 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

示例5: commit

 /** @return void */
 public function commit()
 {
     $this->connection->commit();
 }
開發者ID:vladimirslevercz,項目名稱:alena,代碼行數:5,代碼來源:Context.php


注:本文中的Nette\Database\Connection::commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。