本文整理汇总了PHP中PDOStatement::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP PDOStatement::fetch方法的具体用法?PHP PDOStatement::fetch怎么用?PHP PDOStatement::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDOStatement
的用法示例。
在下文中一共展示了PDOStatement::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prefetch
/**
* Prefetch data
*/
protected function prefetch()
{
if (!$this->currentFetched) {
$this->currentData = $this->statement->fetch();
$this->currentFetched = true;
}
}
示例2: next
/**
* @inheritDoc
*/
public function next()
{
$this->cursorOffset++;
// Fetching one row, located at the given offset in the result set
// (This is what PDO::FETCH_ORI_ABS is for).
$this->currentRow = $this->statement->fetch(\PDO::FETCH_ASSOC, \PDO::FETCH_ORI_ABS, $this->cursorOffset);
}
示例3: fetch
/**
* 获取单条数据
* @param string $fetchStyle
* @throws \HuiLib\Error\Exception
* @return array|object
*/
public function fetch()
{
if ($this->innerStatment == NULL) {
throw new \HuiLib\Error\Exception('fetch必须先调用Query::query');
}
return $this->innerStatment->fetch($this->fetchStyle);
}
示例4: getLine
function getLine()
{
if (!$this->_result) {
return false;
}
return $this->_result->fetch(PDO::FETCH_ASSOC);
}
示例5: fetchRow
protected function fetchRow()
{
$this->current = $this->pdoStatement->fetch();
if ($this->current) {
$this->current->castInts();
$this->current->setNew(false);
}
}
示例6: read
/**
* Reads a piece of input data and advance to the next one.
* Implementations must return null at the end of the input data set.
* @return mixed
*/
public function read()
{
if (!$this->ready) {
$this->init();
}
$data = $this->stmnt->fetch(\PDO::FETCH_ASSOC);
return $data ? $data : null;
}
示例7: rewind
/**
* {@inheritdoc}
*/
public function rewind()
{
if ($this->rewinded) {
throw new InvalidMethodCallException('Cannot rewind a PDOStatement');
}
$this->current = $this->statement->fetch(\PDO::FETCH_ASSOC);
$this->rewinded = true;
}
示例8: next
/** * @inheritDoc */
public function next()
{
$this->key++;
$this->result = $this->pdoStatement->fetch(\PDO::FETCH_OBJ, \PDO::FETCH_ORI_ABS, $this->key);
if (false === $this->result) {
$this->valid = false;
return null;
}
}
示例9: getDruaplNodeIdByWpPostId
private function getDruaplNodeIdByWpPostId($wpPostId)
{
$this->getDruaplNodeIdByWpPostIdStatement->execute(array(':wp_post_id' => $wpPostId));
$result = $this->getDruaplNodeIdByWpPostIdStatement->fetch(PDO::FETCH_ASSOC);
if (!$result['nid']) {
throw new Exception('No WP post ID: ' . $wpPostId);
}
return $result['nid'];
}
示例10: next
/**
* @inheritDoc
*/
public function next()
{
$this->key++;
$this->result = $this->pdoStatement->fetch(PDO::FETCH_OBJ, PDO::FETCH_ORI_ABS, $this->key);
if ($this->result === FALSE) {
$this->valid = FALSE;
return NULL;
}
}
示例11: find
/**
* <b>O parametro deve ser um array atribuitivo apenas com Id da tabela</b>
*
* @param array $Dados
* @return array
*/
public function find(array $Dados)
{
$Condicao = array_keys($Dados)[0];
$Id = "{$Condicao} = :{$Condicao}";
$sql = "SELECT * FROM {$this->Table} WHERE {$Id}";
$this->Stmt = Conn::prepare($sql);
$this->Stmt->execute($Dados);
return $this->Stmt->fetch();
}
示例12: next
/**
* Fetch next result
*
* @param boolean|string $object Fetch as object
* @return \stdClass
*/
public function next($object = TRUE)
{
if ($object) {
if ($object === TRUE) {
return $this->stmt->fetchObject();
}
return $this->stmt->fetchObject($object);
}
return $this->stmt->fetch(\PDO::FETCH_ASSOC);
}
示例13: fetch
public function fetch()
{
$this->executeQuery();
$rs = $this->statement->fetch(PDO::FETCH_ASSOC);
if ($rs === null) {
return false;
} else {
return $rs;
}
}
示例14: next
/**
* Advances the curesor in the statement
* Closes the cursor if the end of the statement is reached
*/
public function next()
{
$this->currentRow = $this->stmt->fetch(PDO::FETCH_NUM);
$this->currentKey++;
$this->isValid = (bool) $this->currentRow;
if (!$this->isValid) {
$this->closeCursor();
if ($this->enableInstancePoolingOnFinish) {
Propel::enableInstancePooling();
}
}
}
示例15: next
public function next()
{
$this->current = null;
if (($restore = $this->statement->fetch(\PDO::FETCH_ASSOC)) !== false) {
$this->current = clone $this->storable;
$this->current->schema()->validate($restore);
if (isset($restore['guid'])) {
$this->current->guid($restore['guid']);
$this->storage->register($this->current);
}
$this->current->restore($restore);
}
}