TableSelect::limit

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

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

説明

public 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
        )
)
add a note add a note

User Contributed Notes

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