« TableSelect::having
TableSelect::lockExclusive »

TableSelect::limit

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

TableSelect::limit — 選択される行の数を限定する

説明

public function mysql_xdevapi\TableSelect::limit(int $rows): mysql_xdevapi\TableSelect

返されるレコードまたはドキュメントの数の最大値を設定します。

パラメータ

rows

レコードまたはドキュメントの数の最大値

戻り値

TableSelect オブジェクトを返します

例

例1 mysql_xdevapi\TableSelect::limit() の例

<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$schema = $session->getSchema("addressbook");
$table  = $schema->getTable("names");

$result = $table->select('name', 'age')
  ->limit(1)
  ->execute();

$row = $result->fetchAll();
print_r($row);
?>

上の例の出力は、 たとえば以下のようになります。

Array
(
    [0] => Array
        (
            [name] => John
            [age] => 42
        )
)
関連キーワード:
TableSelect   mysql   xdevapi   limit   選択   限定   rows   レコード   ドキュメント   最大値   session   schema   table   lockExclusive   information   available   getSession   mysqlx   user   password   localhost   getSchema   addressbook   getTable   names
関連する関数・ページ:
mysql-xdevapi-tableselect.lockexclusive   mysql-xdevapi-tableselect.where   mysql-xdevapi-tableselect.lockshared   mysql-xdevapi-tableselect.construct   mysql-xdevapi-tableselect.bind   mysql-xdevapi-tableselect.execute