<?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);
?>
Il precedente esempio visualizzerà
qualcosa simile a:
Array
(
[0] => Array
(
[name] => John
[age] => 42
)
[1] => Array
(
[name] => Sam
[age] => 42
)
)