Example #1
0
 /**
  * Fetch Zend statement instance
  *
  * @param Zend_Db_Statement_Interface|Zend_Db_Select|string $query
  * @param Zend_Db_Adapter_Abstract $conn
  * @return Zend_Db_Statement_Interface
  * @throws Mage_Core_Exception
  */
 protected function _getStatement($query, $conn = null)
 {
     if ($query instanceof Zend_Db_Statement_Interface) {
         return $query;
     }
     if ($query instanceof Zend_Db_Select) {
         return $query->query();
     }
     if (is_string($query)) {
         if (!$conn instanceof Zend_Db_Adapter_Abstract) {
             Mage::throwException(Mage::helper('Mage_Core_Helper_Data')->__('Invalid connection'));
         }
         return $conn->query($query);
     }
     Mage::throwException(Mage::helper('Mage_Core_Helper_Data')->__('Invalid query'));
 }
Example #2
0
 /**
  * Fetch Zend statement instance
  *
  * @param \Zend_Db_Statement_Interface|\Magento\Framework\DB\Select|string $query
  * @param AdapterInterface $connection
  * @return \Zend_Db_Statement_Interface
  * @throws LocalizedException
  */
 protected function _getStatement($query, AdapterInterface $connection = null)
 {
     if ($query instanceof \Zend_Db_Statement_Interface) {
         return $query;
     }
     if ($query instanceof \Zend_Db_Select) {
         return $query->query();
     }
     if (is_string($query)) {
         if (!$connection instanceof AdapterInterface) {
             throw new LocalizedException(new Phrase('Invalid connection'));
         }
         return $connection->query($query);
     }
     throw new LocalizedException(new Phrase('Invalid query'));
 }
Example #3
0
 /**
  * Fetch Zend statement instance
  *
  * @param \Zend_Db_Statement_Interface|Zend_Db_Select|string $query
  * @param \Zend_Db_Adapter_Abstract $conn
  * @return \Zend_Db_Statement_Interface
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function _getStatement($query, $conn = null)
 {
     if ($query instanceof \Zend_Db_Statement_Interface) {
         return $query;
     }
     if ($query instanceof \Zend_Db_Select) {
         return $query->query();
     }
     if (is_string($query)) {
         if (!$conn instanceof \Zend_Db_Adapter_Abstract) {
             throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Invalid connection'));
         }
         return $conn->query($query);
     }
     throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Invalid query'));
 }
 /**
  * Fetch Zend statement instance
  *
  * @param Zend_Db_Statement_Interface|Zend_Db_Select|string $query
  * @param Zend_Db_Adapter_Abstract $conn
  * @return Zend_Db_Statement_Interface
  */
 protected function _getStatement($query, $conn = null)
 {
     if ($query instanceof Zend_Db_Statement_Interface) {
         return $query;
     }
     if ($query instanceof Zend_Db_Select) {
         return $query->query();
     }
     $hlp = AO::helper('core');
     if (is_string($query)) {
         if (!$conn instanceof Zend_Db_Adapter_Abstract) {
             AO::throwException($hlp->__('Invalid connection'));
         }
         return $conn->query($query);
     }
     AO::throwException($hlp->__('Invalid query'));
 }