本文整理汇总了PHP中Zend_Db_Statement_Pdo::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Statement_Pdo::fetch方法的具体用法?PHP Zend_Db_Statement_Pdo::fetch怎么用?PHP Zend_Db_Statement_Pdo::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Statement_Pdo
的用法示例。
在下文中一共展示了Zend_Db_Statement_Pdo::fetch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* Fetches a row from the result set.
*
* @param int $style OPTIONAL Fetch mode for this fetch operation.
* @param int $cursor OPTIONAL Absolute, relative, or other.
* @param int $offset OPTIONAL Number for absolute or relative cursors.
* @return mixed Array, object, or scalar depending on fetch mode.
* @throws Zend_Db_Statement_Exception
*/
public function fetch($style = null, $cursor = null, $offset = null)
{
$row = parent::fetch($style, $cursor, $offset);
$remove = $this->_adapter->foldCase('zend_db_rownum');
if (is_array($row) && array_key_exists($remove, $row)) {
unset($row[$remove]);
}
return $row;
}
示例2: fetchItem
/**
* Fetch statement
*
* @return mixed
*/
public function fetchItem()
{
if (null === $this->fetchStmt) {
$this->fetchStmt = $this->getConnection()->query($this->getSelect(), $this->bindParams);
}
$data = $this->fetchStmt->fetch();
if (!$data) {
$data = [];
}
return $data;
}
示例3: fetchItem
/**
* Returns a collection item that corresponds to the fetched row
* and moves the internal data pointer ahead
*
* @return Varien_Object|bool
*/
public function fetchItem()
{
if (null === $this->_fetchStmt) {
$this->_fetchStmt = $this->getConnection()->query($this->getSelect());
}
$data = $this->_fetchStmt->fetch();
if (!empty($data) && is_array($data)) {
$item = $this->getNewEmptyItem();
if ($this->getIdFieldName()) {
$item->setIdFieldName($this->getIdFieldName());
}
$item->setData($data);
return $item;
}
return false;
}