// Wrap the rownum query in a sub-query to allow writelocks without ORA-02014 error
if ($this->driverConnection->
getDatabasePlatform() instanceof OraclePlatform
) { $sql =
$this->
createQueryBuilder('w'
) ->
where('w.id IN ('.
str_replace('SELECT a.* FROM', 'SELECT a.id FROM',
$sql).')'
) ->
getSQL();
} // use SELECT ... FOR UPDATE to lock table
$stmt =
$this->
executeQuery( $sql.' '.
$this->driverConnection->
getDatabasePlatform()->
getWriteLockSQL(),
$query->
getParameters(),
$query->
getParameterTypes() );
$doctrineEnvelope =
$stmt instanceof Result ?
$stmt->
fetchAssociative() :
$stmt->
fetch();
if (false ===
$doctrineEnvelope) { $this->driverConnection->
commit();
$this->queueEmptiedAt =
microtime(true
) * 1000;
return null;
} // Postgres can "group" notifications having the same channel and payload
// We need to be sure to empty the queue before blocking again