(No version information available, might only be in Git)
TableSelect::lockExclusive — Führt eine Operation mit EXCLUSIVE LOCK aus
$lock_waiting_option = ?): mysql_xdevapi\TableSelectFührt eine Leseoperation mit EXCLUSIVE LOCK (exklusive Sperre) aus. Es kann jeweils nur eine Sperre aktiv sein.
lock_waiting_option
Die optionale Warteoption; Voreingestellt ist
MYSQLX_LOCK_DEFAULT. Folgende Werte sind zulässig:
Gibt ein TableSelect-Objekt zurück.
Beispiel #1 mysql_xdevapi\TableSelect::lockExclusive()-Beispiel
<?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);
?>Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
Array
(
[0] => Array
(
[name] => John
[age] => 42
)
[1] => Array
(
[name] => Sam
[age] => 42
)
)