本文整理汇总了PHP中Zend_Db_Adapter_Abstract::getFetchMode方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Adapter_Abstract::getFetchMode方法的具体用法?PHP Zend_Db_Adapter_Abstract::getFetchMode怎么用?PHP Zend_Db_Adapter_Abstract::getFetchMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Adapter_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Adapter_Abstract::getFetchMode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
/**
* Executes the current select object and returns the result
*
* @param integer $fetchMode OPTIONAL
* @return PDO_Statement|Zend_Db_Statement
*/
public function query($fetchMode = null)
{
$stmt = $this->_adapter->query($this);
if ($fetchMode == null) {
$fetchMode = $this->_adapter->getFetchMode();
}
$stmt->setFetchMode($fetchMode);
return $stmt;
}
示例2: query
/**
* Executes the current select object and returns the result
*
* @param integer $fetchMode OPTIONAL
* @param mixed $bind An array of data to bind to the placeholders.
* @return PDO_Statement|Zend_Db_Statement
*/
public function query($fetchMode = null, $bind = array())
{
if (!empty($bind)) {
$this->bind($bind);
}
$stmt = $this->_adapter->query($this);
if ($fetchMode == null) {
$fetchMode = $this->_adapter->getFetchMode();
}
$stmt->setFetchMode($fetchMode);
return $stmt;
}
示例3: _authenticateQuerySelect
/**
* _authenticateQuerySelect() - This method accepts a Zend_Db_Select object and
* performs a query against the database with that object.
*
* @param Zend_Db_Select $dbSelect
* @throws \Zend\Authentication\Adapter\Exception - when an invalid select
* object is encountered
* @return array
*/
protected function _authenticateQuerySelect(\Zend_Db_Select $dbSelect)
{
try {
if ($this->_zendDb->getFetchMode() != \Zend_DB::FETCH_ASSOC) {
$origDbFetchMode = $this->_zendDb->getFetchMode();
$this->_zendDb->setFetchMode(\Zend_DB::FETCH_ASSOC);
}
$resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString());
if (isset($origDbFetchMode)) {
$this->_zendDb->setFetchMode($origDbFetchMode);
unset($origDbFetchMode);
}
} catch (\Exception $e) {
throw new Exception('The supplied parameters to Zend\\Authentication\\Adapter\\DbTable failed to ' . 'produce a valid sql statement, please check table and column names ' . 'for validity.', 0, $e);
}
return $resultIdentities;
}
示例4: _authenticateQuerySelect
/**
* _authenticateQuerySelect() - This method accepts a Zend_Db_Select object and
* performs a query against the database with that object.
*
* @param Zend_Db_Select $dbSelect
* @throws Zend_Auth_Adapter_Exception - when an invalid select
* object is encountered
* @return array
*/
protected function _authenticateQuerySelect(Zend_Db_Select $dbSelect)
{
try {
if ($this->_zendDb->getFetchMode() != Zend_DB::FETCH_ASSOC) {
$origDbFetchMode = $this->_zendDb->getFetchMode();
$this->_zendDb->setFetchMode(Zend_DB::FETCH_ASSOC);
}
$resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString());
if (isset($origDbFetchMode)) {
$this->_zendDb->setFetchMode($origDbFetchMode);
unset($origDbFetchMode);
}
} catch (Exception $e) {
/**
* @see Zend_Auth_Adapter_Exception
*/
require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('The supplied parameters to Zend_Auth_Adapter_DbTable failed to ' . 'produce a valid sql statement, please check table and column names ' . 'for validity.', 0, $e);
}
return $resultIdentities;
}
示例5: _authenticateQuerySelect
/**
* _authenticateQuerySelect() - This method accepts a Zend_Db_Select object and
* performs a query against the database with that object.
*
* @param Zend_Db_Select $dbSelect
* @throws Zend_Auth_Adapter_Exception - when an invalid select
* object is encountered
* @return array
*/
protected function _authenticateQuerySelect(Zend_Db_Select $dbSelect)
{
try {
if ($this->_zendDb->getFetchMode() != Zend_DB::FETCH_ASSOC) {
$origDbFetchMode = $this->_zendDb->getFetchMode();
$this->_zendDb->setFetchMode(Zend_DB::FETCH_ASSOC);
}
$resultIdentities = $this->_zendDb->fetchAll($dbSelect);
if (isset($origDbFetchMode)) {
$this->_zendDb->setFetchMode($origDbFetchMode);
unset($origDbFetchMode);
}
} catch (Exception $e) {
/**
* @see Zend_Auth_Adapter_Exception
*/
require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception('O sistema falhou ao tentar executar o script de autenticação. ' . 'Por favor, entre em contato com o suporte ' . 'e informe o ocorrido..', 0, $e);
}
return $resultIdentities;
}
示例6: _fetch
/**
* Support method for fetching rows.
*
* @param string $type Whether to fetch 'all' or 'row'.
* @param string|array $where OPTIONAL An SQL WHERE clause.
* @param string|array $order OPTIONAL An SQL ORDER clause.
* @param int $count OPTIONAL An SQL LIMIT count.
* @param int $offset OPTIONAL An SQL LIMIT offset.
* @return mixed The row results per the Zend_Db_Adapter fetch mode.
*/
protected function _fetch($type, $where = null, $order = null, $count = null, $offset = null)
{
// selection tool
$select = $this->_db->select();
// the FROM clause
$select->from($this->_name, $this->_cols);
// the WHERE clause
$where = (array) $where;
foreach ($where as $key => $val) {
// is $key an int?
if (is_int($key)) {
// $val is the full condition
$select->where($val);
} else {
// $key is the condition with placeholder,
// and $val is quoted into the condition
$select->where($key, $val);
}
}
// the ORDER clause
if (!is_array($order)) {
$order = array($order);
}
foreach ($order as $val) {
$select->order($val);
}
// the LIMIT clause
$select->limit($count, $offset);
// return the results
$method = "fetch{$type}";
$mode = $this->_db->getFetchMode();
$this->_db->setFetchMode(Zend_Db::FETCH_ASSOC);
$data = $this->_db->{$method}($select);
$this->_db->setFetchMode($mode);
return $data;
}
示例7: getFetchMode
/**
* Get the fetch mode.
*
* @return int
*/
public function getFetchMode()
{
return $this->_adapter->getFetchMode();
}