本文整理汇总了PHP中Statement::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Statement::fetchAll方法的具体用法?PHP Statement::fetchAll怎么用?PHP Statement::fetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::fetchAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: move
/**
* Move: Random access to a specific row in the recordset.
* Some databases do not support
* access to previous rows in the databases (no scrolling backwards).
*
* @param rowNumber is the row to move to (0-based)
*
* @return true if there still rows available,
* or false if there are no more rows (EOF).
*/
public function move($rowNumber = 0)
{
$this->EOF = false;
if ($this->numOfRows > 0 && $rowNumber >= $this->numOfRows) {
$rowNumber = $this->numOfRows - 2;
// Overflow to last record
}
if ($rowNumber == $this->currentRow) {
return true;
}
if ($this->canSeek) {
$fields = $this->statement->fetch($rowNumber);
} else {
if ($this->bufferedResults === null) {
$this->bufferedResults = $this->statement->fetchAll();
}
$fields = $this->bufferedResults[$rowNumber];
}
if ($fields) {
$this->fields = $fields;
$this->currentRow = $rowNumber;
return true;
}
$this->fields = false;
$this->EOF = true;
return false;
}
示例2: __construct
/**
* @param Statement $query
*/
public function __construct(Statement $query)
{
$this->query = $query;
$this->results = $query->fetchAll();
}
示例3: __construct
/**
* Constructor
*
* @param mixed $statement statement
*/
public function __construct(Statement $statement)
{
$this->_data = $statement->fetchAll();
}