array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'mysql-xdevapi-tableselect.limit.php', 1 => 'TableSelect::limit', ), 'up' => array ( 0 => 'class.mysql-xdevapi-tableselect.php', 1 => 'mysql_xdevapi\\TableSelect', ), 'prev' => array ( 0 => 'mysql-xdevapi-tableselect.having.php', 1 => 'TableSelect::having', ), 'next' => array ( 0 => 'mysql-xdevapi-tableselect.lockexclusive.php', 1 => 'TableSelect::lockExclusive', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mysql_xdevapi/mysql_xdevapi/tableselect/limit.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(No version information available, might only be in Git)
TableSelect::limit — Limit selected rows
Sets the maximum number of records or documents to return.
rows
The maximum number of records or documents.
A TableSelect object.
示例 #1 mysql_xdevapi\TableSelect::limit() example
<?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 ) )