array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'mysql-xdevapi-collectionfind.lockexclusive.php', 1 => 'CollectionFind::lockExclusive', ), 'up' => array ( 0 => 'class.mysql-xdevapi-collectionfind.php', 1 => 'mysql_xdevapi\\CollectionFind', ), 'prev' => array ( 0 => 'mysql-xdevapi-collectionfind.limit.php', 1 => 'CollectionFind::limit', ), 'next' => array ( 0 => 'mysql-xdevapi-collectionfind.lockshared.php', 1 => 'CollectionFind::lockShared', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/mysql_xdevapi/mysql_xdevapi/collectionfind/lockexclusive.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(No version information available, might only be in Git)
CollectionFind::lockExclusive — Execute operation with EXCLUSIVE LOCK
$lock_waiting_option
= ?): mysql_xdevapi\CollectionFind
ドキュメントを排他ロックします。
ドキュメントがロックされている間、
他のトランザクションはドキュメントを更新できませんし、
SELECT ... LOCK IN SHARE MODE
を使ったり、
トランザクション分離レベルにあるデータの読み取りができません。
一貫性のある読み取りはあらゆるロックを無視します。
並列処理の問題を避けるために、この機能は mysql_xdevapi\Collection::modify() コマンドから直接使うのが有用です。 基本的に、このコマンドは行ロックを通してアクセスを直列化します。
lock_waiting_option
オプションで指定できる、ロック待ちのオプション。
デフォルトは MYSQLX_LOCK_DEFAULT
です。
有効な値は以下のとおりです:
後の処理に使える CollectionFind オブジェクトを返します。
例1 mysql_xdevapi\CollectionFind::lockExclusive() の例
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$schema = $session->getSchema("addressbook");
$collection = $schema->createCollection("people");
$session->startTransaction();
$result = $collection
->find("age > 50")
->lockExclusive()
->execute();
// ... do an operation on the object
// Complete the transaction and unlock the document
$session->commit();
?>