本文整理汇总了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();
}
示例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++;
}
示例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());
}
示例4: beginTransaction
/** @return void */
public function beginTransaction()
{
$this->connection->beginTransaction();
}
示例5: begin
/** @return void */
public function begin()
{
if (self::$transactionCounter[$this->getDsnKey()]++ === 0) {
$this->connection->beginTransaction();
}
}