commit() public method

public commit ( ) : void
return void
Example #1
0
 /** @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();
     }
 }
Example #2
0
 /**
  * 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();
 }
Example #3
0
 /**
  * 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);
     }
 }
Example #4
0
 /**
  * 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 F*****G 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());
 }
Example #5
0
 /** @return void */
 public function commit()
 {
     $this->connection->commit();
 }