本文整理匯總了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;
}