|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Db |
|
17 * @subpackage Statement |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * Emulates a PDOStatement for native database adapters. |
|
25 * |
|
26 * @category Zend |
|
27 * @package Zend_Db |
|
28 * @subpackage Statement |
|
29 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
30 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
31 */ |
|
32 interface Zend_Db_Statement_Interface |
|
33 { |
|
34 |
|
35 /** |
|
36 * Bind a column of the statement result set to a PHP variable. |
|
37 * |
|
38 * @param string $column Name the column in the result set, either by |
|
39 * position or by name. |
|
40 * @param mixed $param Reference to the PHP variable containing the value. |
|
41 * @param mixed $type OPTIONAL |
|
42 * @return bool |
|
43 * @throws Zend_Db_Statement_Exception |
|
44 */ |
|
45 public function bindColumn($column, &$param, $type = null); |
|
46 |
|
47 /** |
|
48 * Binds a parameter to the specified variable name. |
|
49 * |
|
50 * @param mixed $parameter Name the parameter, either integer or string. |
|
51 * @param mixed $variable Reference to PHP variable containing the value. |
|
52 * @param mixed $type OPTIONAL Datatype of SQL parameter. |
|
53 * @param mixed $length OPTIONAL Length of SQL parameter. |
|
54 * @param mixed $options OPTIONAL Other options. |
|
55 * @return bool |
|
56 * @throws Zend_Db_Statement_Exception |
|
57 */ |
|
58 public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null); |
|
59 |
|
60 /** |
|
61 * Binds a value to a parameter. |
|
62 * |
|
63 * @param mixed $parameter Name the parameter, either integer or string. |
|
64 * @param mixed $value Scalar value to bind to the parameter. |
|
65 * @param mixed $type OPTIONAL Datatype of the parameter. |
|
66 * @return bool |
|
67 * @throws Zend_Db_Statement_Exception |
|
68 */ |
|
69 public function bindValue($parameter, $value, $type = null); |
|
70 |
|
71 /** |
|
72 * Closes the cursor, allowing the statement to be executed again. |
|
73 * |
|
74 * @return bool |
|
75 * @throws Zend_Db_Statement_Exception |
|
76 */ |
|
77 public function closeCursor(); |
|
78 |
|
79 /** |
|
80 * Returns the number of columns in the result set. |
|
81 * Returns null if the statement has no result set metadata. |
|
82 * |
|
83 * @return int The number of columns. |
|
84 * @throws Zend_Db_Statement_Exception |
|
85 */ |
|
86 public function columnCount(); |
|
87 |
|
88 /** |
|
89 * Retrieves the error code, if any, associated with the last operation on |
|
90 * the statement handle. |
|
91 * |
|
92 * @return string error code. |
|
93 * @throws Zend_Db_Statement_Exception |
|
94 */ |
|
95 public function errorCode(); |
|
96 |
|
97 /** |
|
98 * Retrieves an array of error information, if any, associated with the |
|
99 * last operation on the statement handle. |
|
100 * |
|
101 * @return array |
|
102 * @throws Zend_Db_Statement_Exception |
|
103 */ |
|
104 public function errorInfo(); |
|
105 |
|
106 /** |
|
107 * Executes a prepared statement. |
|
108 * |
|
109 * @param array $params OPTIONAL Values to bind to parameter placeholders. |
|
110 * @return bool |
|
111 * @throws Zend_Db_Statement_Exception |
|
112 */ |
|
113 public function execute(array $params = array()); |
|
114 |
|
115 /** |
|
116 * Fetches a row from the result set. |
|
117 * |
|
118 * @param int $style OPTIONAL Fetch mode for this fetch operation. |
|
119 * @param int $cursor OPTIONAL Absolute, relative, or other. |
|
120 * @param int $offset OPTIONAL Number for absolute or relative cursors. |
|
121 * @return mixed Array, object, or scalar depending on fetch mode. |
|
122 * @throws Zend_Db_Statement_Exception |
|
123 */ |
|
124 public function fetch($style = null, $cursor = null, $offset = null); |
|
125 |
|
126 /** |
|
127 * Returns an array containing all of the result set rows. |
|
128 * |
|
129 * @param int $style OPTIONAL Fetch mode. |
|
130 * @param int $col OPTIONAL Column number, if fetch mode is by column. |
|
131 * @return array Collection of rows, each in a format by the fetch mode. |
|
132 * @throws Zend_Db_Statement_Exception |
|
133 */ |
|
134 public function fetchAll($style = null, $col = null); |
|
135 |
|
136 /** |
|
137 * Returns a single column from the next row of a result set. |
|
138 * |
|
139 * @param int $col OPTIONAL Position of the column to fetch. |
|
140 * @return string |
|
141 * @throws Zend_Db_Statement_Exception |
|
142 */ |
|
143 public function fetchColumn($col = 0); |
|
144 |
|
145 /** |
|
146 * Fetches the next row and returns it as an object. |
|
147 * |
|
148 * @param string $class OPTIONAL Name of the class to create. |
|
149 * @param array $config OPTIONAL Constructor arguments for the class. |
|
150 * @return mixed One object instance of the specified class. |
|
151 * @throws Zend_Db_Statement_Exception |
|
152 */ |
|
153 public function fetchObject($class = 'stdClass', array $config = array()); |
|
154 |
|
155 /** |
|
156 * Retrieve a statement attribute. |
|
157 * |
|
158 * @param string $key Attribute name. |
|
159 * @return mixed Attribute value. |
|
160 * @throws Zend_Db_Statement_Exception |
|
161 */ |
|
162 public function getAttribute($key); |
|
163 |
|
164 /** |
|
165 * Retrieves the next rowset (result set) for a SQL statement that has |
|
166 * multiple result sets. An example is a stored procedure that returns |
|
167 * the results of multiple queries. |
|
168 * |
|
169 * @return bool |
|
170 * @throws Zend_Db_Statement_Exception |
|
171 */ |
|
172 public function nextRowset(); |
|
173 |
|
174 /** |
|
175 * Returns the number of rows affected by the execution of the |
|
176 * last INSERT, DELETE, or UPDATE statement executed by this |
|
177 * statement object. |
|
178 * |
|
179 * @return int The number of rows affected. |
|
180 * @throws Zend_Db_Statement_Exception |
|
181 */ |
|
182 public function rowCount(); |
|
183 |
|
184 /** |
|
185 * Set a statement attribute. |
|
186 * |
|
187 * @param string $key Attribute name. |
|
188 * @param mixed $val Attribute value. |
|
189 * @return bool |
|
190 * @throws Zend_Db_Statement_Exception |
|
191 */ |
|
192 public function setAttribute($key, $val); |
|
193 |
|
194 /** |
|
195 * Set the default fetch mode for this statement. |
|
196 * |
|
197 * @param int $mode The fetch mode. |
|
198 * @return bool |
|
199 * @throws Zend_Db_Statement_Exception |
|
200 */ |
|
201 public function setFetchMode($mode); |
|
202 |
|
203 } |