File indexing completed on 2025-01-19 05:21:02

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Db
0017  * @subpackage Statement
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @see Zend_Db_Statement_Pdo
0025  */
0026 // require_once 'Zend/Db/Statement/Pdo.php';
0027 
0028 /**
0029  * Proxy class to wrap a PDOStatement object for IBM Databases.
0030  * Matches the interface of PDOStatement.  All methods simply proxy to the
0031  * matching method in PDOStatement.  PDOExceptions thrown by PDOStatement
0032  * are re-thrown as Zend_Db_Statement_Exception.
0033  *
0034  * @category   Zend
0035  * @package    Zend_Db
0036  * @subpackage Statement
0037  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0038  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0039  */
0040 class Zend_Db_Statement_Pdo_Oci extends Zend_Db_Statement_Pdo
0041 {
0042 
0043     /**
0044     * Returns an array containing all of the result set rows.
0045     *
0046     * Behaves like parent, but if limit()
0047     * is used, the final result removes the extra column
0048     * 'zend_db_rownum'
0049     *
0050     * @param int $style OPTIONAL Fetch mode.
0051     * @param int $col   OPTIONAL Column number, if fetch mode is by column.
0052     * @return array Collection of rows, each in a format by the fetch mode.
0053     * @throws Zend_Db_Statement_Exception
0054     */
0055     public function fetchAll($style = null, $col = null)
0056     {
0057         $data = parent::fetchAll($style, $col);
0058         $results = array();
0059         $remove = $this->_adapter->foldCase('zend_db_rownum');
0060 
0061         foreach ($data as $row) {
0062             if (is_array($row) && array_key_exists($remove, $row)) {
0063                 unset($row[$remove]);
0064             }
0065             $results[] = $row;
0066         }
0067         return $results;
0068     }
0069 
0070 
0071     /**
0072      * Fetches a row from the result set.
0073      *
0074      * @param int $style  OPTIONAL Fetch mode for this fetch operation.
0075      * @param int $cursor OPTIONAL Absolute, relative, or other.
0076      * @param int $offset OPTIONAL Number for absolute or relative cursors.
0077      * @return mixed Array, object, or scalar depending on fetch mode.
0078      * @throws Zend_Db_Statement_Exception
0079      */
0080     public function fetch($style = null, $cursor = null, $offset = null)
0081     {
0082         $row = parent::fetch($style, $cursor, $offset);
0083 
0084         $remove = $this->_adapter->foldCase('zend_db_rownum');
0085         if (is_array($row) && array_key_exists($remove, $row)) {
0086             unset($row[$remove]);
0087         }
0088 
0089         return $row;
0090     }
0091 }