本文整理汇总了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();
}
}
示例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();
}
示例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);
}
}
示例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());
}
示例5: commit
/** @return void */
public function commit()
{
$this->connection->commit();
}