本文整理匯總了PHP中OCP\IDBConnection::unlockTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP IDBConnection::unlockTable方法的具體用法?PHP IDBConnection::unlockTable怎麽用?PHP IDBConnection::unlockTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OCP\IDBConnection
的用法示例。
在下文中一共展示了IDBConnection::unlockTable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getNext
/**
* get the next job in the list
*
* @return IJob|null
*/
public function getNext()
{
$query = $this->connection->getQueryBuilder();
$query->select('*')->from('jobs')->where($query->expr()->lte('reserved_at', $query->createNamedParameter($this->timeFactory->getTime() - 12 * 3600, IQueryBuilder::PARAM_INT)))->orderBy('last_checked', 'ASC')->setMaxResults(1);
$update = $this->connection->getQueryBuilder();
$update->update('jobs')->set('reserved_at', $update->createNamedParameter($this->timeFactory->getTime()))->set('last_checked', $update->createNamedParameter($this->timeFactory->getTime()))->where($update->expr()->eq('id', $update->createParameter('jobid')));
$this->connection->lockTable('jobs');
$result = $query->execute();
$row = $result->fetch();
$result->closeCursor();
if ($row) {
$update->setParameter('jobid', $row['id']);
$update->execute();
$this->connection->unlockTable();
$job = $this->buildJob($row);
if ($job === null) {
// Background job from disabled app, try again.
return $this->getNext();
}
return $job;
} else {
$this->connection->unlockTable();
return null;
}
}
示例2: unlockTable
/**
* @inheritdoc
*/
public function unlockTable()
{
$this->connection->unlockTable();
}