CascadiaPHP 2024


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

CollectionFind::lockSharedExecute operation with SHARED LOCK


public mysql_xdevapi\CollectionFind::lockShared(int $lock_waiting_option = ?): mysql_xdevapi\CollectionFind

Allows to share the documents between multiple transactions which are locking in shared mode.

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.

Bağımsız Değişkenler


Optional waiting option. By default it is MYSQLX_LOCK_DEFAULT. Valid values are these constants:

Dönen Değerler

A CollectionFind object that can be used for further processing


Örnek 1 mysql_xdevapi\CollectionFind::lockShared() example

= mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$schema = $session->getSchema("addressbook");
$collection = $schema->createCollection("people");


$result = $collection
->find("age > 50")

// ... read the object in shared mode

// Complete the transaction and unlock the document
add a note

User Contributed Notes

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