本文整理匯總了PHP中JDatabaseDriver::transactionStart方法的典型用法代碼示例。如果您正苦於以下問題:PHP JDatabaseDriver::transactionStart方法的具體用法?PHP JDatabaseDriver::transactionStart怎麽用?PHP JDatabaseDriver::transactionStart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JDatabaseDriver
的用法示例。
在下文中一共展示了JDatabaseDriver::transactionStart方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doDelete
/**
* Do delete action, this method should be override by sub class.
*
* @param mixed $conditions Where conditions, you can use array or Compare object.
*
* @throws \Exception
* @return boolean Will be always true.
*/
protected function doDelete(array $conditions)
{
$query = $this->db->getQuery(true);
// Conditions.
QueryHelper::buildWheres($query, $conditions);
$query->delete($this->table);
$this->db->transactionStart(true);
try {
$result = (bool) $this->db->setQuery($query)->execute();
} catch (\Exception $e) {
$this->db->transactionRollback(true);
throw $e;
}
$this->db->transactionCommit(true);
return $result;
}
示例2: transactionStart
/**
* Method to initialize a transaction.
*
* @param boolean $asSavepoint If true and a transaction is already active, a savepoint will be created.
* @return self Returns this object to support chaining.
*
* @throws \RuntimeException
*/
public function transactionStart($asSavepoint = false)
{
if (version_compare($this->cmsRelease, '3.2', '>=')) {
$this->_db->transactionStart($asSavepoint);
} else {
if (!$asSavepoint || !$this->transactionDepth) {
if ($this->query('START TRANSACTION')) {
$this->transactionDepth = 1;
}
return $this;
}
$savepoint = 'SP_' . $this->transactionDepth;
if ($this->query('SAVEPOINT ' . $this->nameQuote($savepoint))) {
$this->transactionDepth++;
}
}
return $this;
}
示例3: transactionStart
/**
* transactionStart
*
* @param bool $asSavePoint
*
* @return $this
*/
public function transactionStart($asSavePoint = false)
{
$this->db->transactionStart($asSavePoint);
}