本文整理汇总了PHP中Statement::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Statement::fetch方法的具体用法?PHP Statement::fetch怎么用?PHP Statement::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::fetch方法的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
public function __construct(Statement $statement)
{
try {
$this->crit = $statement->getCriteria();
if ($this->crit instanceof Criteria) {
if ($this->crit->action == 'insert') {
$this->insert_id = $statement->getInsertID();
} elseif ($this->crit->action == 'select') {
while ($row = $statement->fetch()) {
$this->rows[] = new Row($row, $statement);
}
$this->max_ptr = count($this->rows);
$this->int_ptr = 0;
} elseif ($this->crit->action = 'count') {
$value = $statement->fetch();
$this->max_ptr = $value['num_col'];
}
}
} catch (\Exception $e) {
throw $e;
}
}
示例3: executeLogFindMany
/**
* executeLogFindMany
*
* Voer een zoekacties op meerdere records uit in de log-tabellen.
* @param Statement $stmt
* @return KVDdom_DomainObjectLogCollection
*/
protected function executeLogFindMany($stmt)
{
$stmt->execute();
$domainObjects = array();
while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
$logObject = $this->doLogLoad($row->id, $row);
$domainObjects[] = $logObject;
}
return new KVDdom_DomainObjectLogCollection($domainObjects);
}