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  * Emulates a PDOStatement for native database adapters.
0025  *
0026  * @category   Zend
0027  * @package    Zend_Db
0028  * @subpackage Statement
0029  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0030  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0031  */
0032 interface Zend_Db_Statement_Interface
0033 {
0034 
0035     /**
0036      * Bind a column of the statement result set to a PHP variable.
0037      *
0038      * @param string $column Name the column in the result set, either by
0039      *                       position or by name.
0040      * @param mixed  $param  Reference to the PHP variable containing the value.
0041      * @param mixed  $type   OPTIONAL
0042      * @return bool
0043      * @throws Zend_Db_Statement_Exception
0044      */
0045     public function bindColumn($column, &$param, $type = null);
0046 
0047     /**
0048      * Binds a parameter to the specified variable name.
0049      *
0050      * @param mixed $parameter Name the parameter, either integer or string.
0051      * @param mixed $variable  Reference to PHP variable containing the value.
0052      * @param mixed $type      OPTIONAL Datatype of SQL parameter.
0053      * @param mixed $length    OPTIONAL Length of SQL parameter.
0054      * @param mixed $options   OPTIONAL Other options.
0055      * @return bool
0056      * @throws Zend_Db_Statement_Exception
0057      */
0058     public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null);
0059 
0060     /**
0061      * Binds a value to a parameter.
0062      *
0063      * @param mixed $parameter Name the parameter, either integer or string.
0064      * @param mixed $value     Scalar value to bind to the parameter.
0065      * @param mixed $type      OPTIONAL Datatype of the parameter.
0066      * @return bool
0067      * @throws Zend_Db_Statement_Exception
0068      */
0069     public function bindValue($parameter, $value, $type = null);
0070 
0071     /**
0072      * Closes the cursor, allowing the statement to be executed again.
0073      *
0074      * @return bool
0075      * @throws Zend_Db_Statement_Exception
0076      */
0077     public function closeCursor();
0078 
0079     /**
0080      * Returns the number of columns in the result set.
0081      * Returns null if the statement has no result set metadata.
0082      *
0083      * @return int The number of columns.
0084      * @throws Zend_Db_Statement_Exception
0085      */
0086     public function columnCount();
0087 
0088     /**
0089      * Retrieves the error code, if any, associated with the last operation on
0090      * the statement handle.
0091      *
0092      * @return string error code.
0093      * @throws Zend_Db_Statement_Exception
0094      */
0095     public function errorCode();
0096 
0097     /**
0098      * Retrieves an array of error information, if any, associated with the
0099      * last operation on the statement handle.
0100      *
0101      * @return array
0102      * @throws Zend_Db_Statement_Exception
0103      */
0104     public function errorInfo();
0105 
0106     /**
0107      * Executes a prepared statement.
0108      *
0109      * @param array $params OPTIONAL Values to bind to parameter placeholders.
0110      * @return bool
0111      * @throws Zend_Db_Statement_Exception
0112      */
0113     public function execute(array $params = array());
0114 
0115     /**
0116      * Fetches a row from the result set.
0117      *
0118      * @param int $style  OPTIONAL Fetch mode for this fetch operation.
0119      * @param int $cursor OPTIONAL Absolute, relative, or other.
0120      * @param int $offset OPTIONAL Number for absolute or relative cursors.
0121      * @return mixed Array, object, or scalar depending on fetch mode.
0122      * @throws Zend_Db_Statement_Exception
0123      */
0124     public function fetch($style = null, $cursor = null, $offset = null);
0125 
0126     /**
0127      * Returns an array containing all of the result set rows.
0128      *
0129      * @param int $style OPTIONAL Fetch mode.
0130      * @param int $col   OPTIONAL Column number, if fetch mode is by column.
0131      * @return array Collection of rows, each in a format by the fetch mode.
0132      * @throws Zend_Db_Statement_Exception
0133      */
0134     public function fetchAll($style = null, $col = null);
0135 
0136     /**
0137      * Returns a single column from the next row of a result set.
0138      *
0139      * @param int $col OPTIONAL Position of the column to fetch.
0140      * @return string
0141      * @throws Zend_Db_Statement_Exception
0142      */
0143     public function fetchColumn($col = 0);
0144 
0145     /**
0146      * Fetches the next row and returns it as an object.
0147      *
0148      * @param string $class  OPTIONAL Name of the class to create.
0149      * @param array  $config OPTIONAL Constructor arguments for the class.
0150      * @return mixed One object instance of the specified class.
0151      * @throws Zend_Db_Statement_Exception
0152      */
0153     public function fetchObject($class = 'stdClass', array $config = array());
0154 
0155     /**
0156      * Retrieve a statement attribute.
0157      *
0158      * @param string $key Attribute name.
0159      * @return mixed      Attribute value.
0160      * @throws Zend_Db_Statement_Exception
0161      */
0162     public function getAttribute($key);
0163 
0164     /**
0165      * Retrieves the next rowset (result set) for a SQL statement that has
0166      * multiple result sets.  An example is a stored procedure that returns
0167      * the results of multiple queries.
0168      *
0169      * @return bool
0170      * @throws Zend_Db_Statement_Exception
0171      */
0172     public function nextRowset();
0173 
0174     /**
0175      * Returns the number of rows affected by the execution of the
0176      * last INSERT, DELETE, or UPDATE statement executed by this
0177      * statement object.
0178      *
0179      * @return int     The number of rows affected.
0180      * @throws Zend_Db_Statement_Exception
0181      */
0182     public function rowCount();
0183 
0184     /**
0185      * Set a statement attribute.
0186      *
0187      * @param string $key Attribute name.
0188      * @param mixed  $val Attribute value.
0189      * @return bool
0190      * @throws Zend_Db_Statement_Exception
0191      */
0192     public function setAttribute($key, $val);
0193 
0194     /**
0195      * Set the default fetch mode for this statement.
0196      *
0197      * @param int   $mode The fetch mode.
0198      * @return bool
0199      * @throws Zend_Db_Statement_Exception
0200      */
0201     public function setFetchMode($mode);
0202 
0203 }