本文整理匯總了PHP中IDatabase::setFlag方法的典型用法代碼示例。如果您正苦於以下問題:PHP IDatabase::setFlag方法的具體用法?PHP IDatabase::setFlag怎麽用?PHP IDatabase::setFlag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IDatabase
的用法示例。
在下文中一共展示了IDatabase::setFlag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doUpdate
public function doUpdate()
{
if (!$this->callback) {
return;
}
$autoTrx = $this->dbw->getFlag(DBO_TRX);
$this->dbw->clearFlag(DBO_TRX);
try {
/** @var Exception $e */
$e = null;
call_user_func_array($this->callback, [$this->dbw, $this->fname]);
} catch (Exception $e) {
}
if ($autoTrx) {
$this->dbw->setFlag(DBO_TRX);
}
if ($e) {
throw $e;
}
}
示例2: applyTransactionRoundFlags
/**
* @param IDatabase $conn
*/
private function applyTransactionRoundFlags(IDatabase $conn)
{
if ($conn->getFlag($conn::DBO_DEFAULT)) {
// DBO_TRX is controlled entirely by CLI mode presence with DBO_DEFAULT.
// Force DBO_TRX even in CLI mode since a commit round is expected soon.
$conn->setFlag($conn::DBO_TRX, $conn::REMEMBER_PRIOR);
// If config has explicitly requested DBO_TRX be either on or off by not
// setting DBO_DEFAULT, then respect that. Forcing no transactions is useful
// for things like blob stores (ExternalStore) which want auto-commit mode.
}
}