(No version information available, might only be in Git)
TableSelect::lockExclusive — Executa EXCLUSIVE LOCK
$lock_waiting_option = ?): mysql_xdevapi\TableSelectExecuta uma operação de leitura com EXCLUSIVE LOCK. Somente uma trava pode estar ativa no mesmo momento.
lock_waiting_option
Espera opcional cujo padrão é MYSQLX_LOCK_DEFAULT.
Valores válidos são:
Objeto TableSelect.
Exemplo #1 Exemplo de mysql_xdevapi\TableSelect::lockExclusive()
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$schema = $session->getSchema("addressbook");
$table = $schema->getTable("names");
$session->startTransaction();
$result = $table->select('name', 'age')
->lockExclusive(MYSQLX_LOCK_NOWAIT)
->execute();
$session->commit();
$row = $result->fetchAll();
print_r($row);
?>O exemplo acima produzirá algo semelhante a:
Array
(
[0] => Array
(
[name] => John
[age] => 42
)
[1] => Array
(
[name] => Sam
[age] => 42
)
)