TableSelect::lockExclusive

(No version information available, might only be in Git)

TableSelect::lockExclusiveFührt eine Operation mit EXCLUSIVE LOCK aus

Beschreibung

public mysql_xdevapi\TableSelect::lockExclusive(int $lock_waiting_option = ?): mysql_xdevapi\TableSelect

Führt eine Leseoperation mit EXCLUSIVE LOCK (exklusive Sperre) aus. Es kann jeweils nur eine Sperre aktiv sein.

Parameter-Liste

lock_waiting_option

Die optionale Warteoption; Voreingestellt ist MYSQLX_LOCK_DEFAULT. Folgende Werte sind zulässig:

Rückgabewerte

Gibt ein TableSelect-Objekt zurück.

Beispiele

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
        )
)
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top