Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * _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(DBSelect $dbSelect)
 {
     try {
         if ($this->_zendDb->getFetchMode() != Db::FETCH_ASSOC) {
             $origDbFetchMode = $this->_zendDb->getFetchMode();
             $this->_zendDb->setFetchMode(Db::FETCH_ASSOC);
         }
         $resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString());
         if (isset($origDbFetchMode)) {
             $this->_zendDb->setFetchMode($origDbFetchMode);
             unset($origDbFetchMode);
         }
     } catch (\Exception $e) {
         throw new Exception\RuntimeException('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;
 }