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_Ibm extends Zend_Db_Statement_Pdo
0041 {
0042     /**
0043     * Returns an array containing all of the result set rows.
0044     *
0045     * Behaves like parent, but if limit()
0046     * is used, the final result removes the extra column
0047     * 'zend_db_rownum'
0048     *
0049     * @param int $style OPTIONAL Fetch mode.
0050     * @param int $col   OPTIONAL Column number, if fetch mode is by column.
0051     * @return array Collection of rows, each in a format by the fetch mode.
0052     * @throws Zend_Db_Statement_Exception
0053     */
0054     public function fetchAll($style = null, $col = null)
0055     {
0056         $data = parent::fetchAll($style, $col);
0057         $results = array();
0058         $remove = $this->_adapter->foldCase('ZEND_DB_ROWNUM');
0059 
0060         foreach ($data as $row) {
0061             if (is_array($row) && array_key_exists($remove, $row)) {
0062                 unset($row[$remove]);
0063             }
0064             $results[] = $row;
0065         }
0066         return $results;
0067     }
0068 
0069     /**
0070      * Binds a parameter to the specified variable name.
0071      *
0072      * @param mixed $parameter Name the parameter, either integer or string.
0073      * @param mixed $variable  Reference to PHP variable containing the value.
0074      * @param mixed $type      OPTIONAL Datatype of SQL parameter.
0075      * @param mixed $length    OPTIONAL Length of SQL parameter.
0076      * @param mixed $options   OPTIONAL Other options.
0077      * @return bool
0078      * @throws Zend_Db_Statement_Exception
0079      */
0080     public function _bindParam($parameter, &$variable, $type = null, $length = null, $options = null)
0081     {
0082         try {
0083             if (($type === null) && ($length === null) && ($options === null)) {
0084                 return $this->_stmt->bindParam($parameter, $variable);
0085             } else {
0086                 return $this->_stmt->bindParam($parameter, $variable, $type, $length, $options);
0087             }
0088         } catch (PDOException $e) {
0089             // require_once 'Zend/Db/Statement/Exception.php';
0090             throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
0091         }
0092     }
0093 
0094 }