TableSelect::lockShared
(No version information available, might only be in Git)
TableSelect::lockShared — SHARED LOCK を実行する
説明
読み取り操作を SHARED LOCK 付きで実行します。
アクティブになれるロックは一度にひとつだけです。
パラメータ
lock_waiting_option
-
オプションで指定できる、ロック待ちのオプション。
デフォルトは MYSQLX_LOCK_DEFAULT
です。
有効な値は以下のとおりです:
戻り値
TableSelect オブジェクトを返します。
例
例1 mysql_xdevapi\TableSelect::lockShared() の例
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$schema = $session->getSchema("addressbook");
$table = $schema->getTable("names");
$session->startTransaction();
$result = $table->select('name', 'age')
->lockShared(MYSQLX_LOCK_NOWAIT)
->execute();
$session->commit();
$row = $result->fetchAll();
print_r($row);
?>
Array
(
[0] => Array
(
[name] => John
[age] => 42
)
[1] => Array
(
[name] => Sam
[age] => 42
)
)
There are no user contributed notes for this page.