CollectionFind::lockShared
(No version information available, might only be in Git)
CollectionFind::lockShared — Execute operation with SHARED LOCK
Descrizione
Other sessions can read the rows, but cannot modify them until your transaction commits.
If any of these rows were changed by another transaction that hasn't been committed,
the query will wait until that transaction has ended to be able to use the latest values.
Elenco dei parametri
lock_waiting_option
-
Optional waiting option. By default it is MYSQLX_LOCK_DEFAULT
. Valid values are these constants:
Valori restituiti
A CollectionFind object that can be used for further processing
Esempi
Example #1 mysql_xdevapi\CollectionFind::lockShared() example
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$schema = $session->getSchema("addressbook");
$collection = $schema->createCollection("people");
$session->startTransaction();
$result = $collection
->find("age > 50")
->lockShared()
->execute();
// ... read the object in shared mode
// Complete the transaction and unlock the document
$session->commit();
?>