本文整理匯總了PHP中RedBeanPHP\R::rollback方法的典型用法代碼示例。如果您正苦於以下問題:PHP R::rollback方法的具體用法?PHP R::rollback怎麽用?PHP R::rollback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RedBeanPHP\R
的用法示例。
在下文中一共展示了R::rollback方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setQueueRowsDone
/**
* Sets multiple queue rows as done
* @param type $rows
*/
public function setQueueRowsDone($rows)
{
R::begin();
foreach ($rows as $row) {
$res = $this->setQueueRowDone($row);
if (!$res) {
return R::rollback();
}
}
return R::commit();
}
示例2: define
defined('ROOT_DIR') || define('ROOT_DIR', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
require_once 'main.php';
configuration();
setAutoloader();
dbconnect();
if (php_sapi_name() != 'cli') {
throw new Exception('This application must be run on the command line.');
}
$images = R::find(Images::tableName(), ' `imgur` IS NULL ');
foreach ($images as $image) {
R::begin();
try {
$imgur = Imgur::facade();
$imgur->setCatalog(trim($image->type, '12'));
$imgur->setFilename(ROOT_DIR . Images::IMAGE_DIRECTORY . DIRECTORY_SEPARATOR . $image->id . '.png');
$imgur->setDescription('R18');
$imgur->setName($image->units->name);
$response = $imgur->uploadFile();
if (isset($response['data']['id']) && isset($response['data']['deletehash'])) {
$image->imgur = $response['data']['id'];
$image->delhash = $response['data']['deletehash'];
R::store($image);
R::commit();
}
} catch (Exception $ex) {
var_dump($ex);
R::rollback();
}
var_dump($response);
sleep(1);
}
示例3: commitBean
/**
* commit a bean with transactions
* @param object $bean
* @return $res false or last insert id
*/
public static function commitBean($bean)
{
R::begin();
try {
$res = R::store($bean);
R::commit();
} catch (Exception $e) {
R::rollback();
$res = false;
}
return $res;
}