1 | <?php |
---|
2 | /* |
---|
3 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
4 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
5 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
6 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
7 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
8 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
9 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
10 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
11 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
12 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
14 | * |
---|
15 | * This software consists of voluntary contributions made by many individuals |
---|
16 | * and is licensed under the LGPL. For more information, see |
---|
17 | * <http://www.doctrine-project.org>. |
---|
18 | */ |
---|
19 | |
---|
20 | namespace Doctrine\DBAL\Driver; |
---|
21 | |
---|
22 | use PDO; |
---|
23 | |
---|
24 | /** |
---|
25 | * Interface for the reading part of a prepare statement only. |
---|
26 | * |
---|
27 | * @author Benjamin Eberlei <kontakt@beberlei.de> |
---|
28 | */ |
---|
29 | interface ResultStatement extends \Traversable |
---|
30 | { |
---|
31 | /** |
---|
32 | * Closes the cursor, enabling the statement to be executed again. |
---|
33 | * |
---|
34 | * @return boolean Returns TRUE on success or FALSE on failure. |
---|
35 | */ |
---|
36 | function closeCursor(); |
---|
37 | |
---|
38 | |
---|
39 | /** |
---|
40 | * columnCount |
---|
41 | * Returns the number of columns in the result set |
---|
42 | * |
---|
43 | * @return integer Returns the number of columns in the result set represented |
---|
44 | * by the PDOStatement object. If there is no result set, |
---|
45 | * this method should return 0. |
---|
46 | */ |
---|
47 | function columnCount(); |
---|
48 | |
---|
49 | /** |
---|
50 | * setFetchMode |
---|
51 | * Set the fetch mode to use while iterating this statement. |
---|
52 | * |
---|
53 | * @param integer $fetchStyle |
---|
54 | */ |
---|
55 | public function setFetchMode($fetchStyle); |
---|
56 | |
---|
57 | /** |
---|
58 | * fetch |
---|
59 | * |
---|
60 | * @see Query::HYDRATE_* constants |
---|
61 | * @param integer $fetchStyle Controls how the next row will be returned to the caller. |
---|
62 | * This value must be one of the Query::HYDRATE_* constants, |
---|
63 | * defaulting to Query::HYDRATE_BOTH |
---|
64 | * |
---|
65 | * @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor, |
---|
66 | * this value determines which row will be returned to the caller. |
---|
67 | * This value must be one of the Query::HYDRATE_ORI_* constants, defaulting to |
---|
68 | * Query::HYDRATE_ORI_NEXT. To request a scrollable cursor for your |
---|
69 | * PDOStatement object, |
---|
70 | * you must set the PDO::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you |
---|
71 | * prepare the SQL statement with Doctrine_Adapter_Interface->prepare(). |
---|
72 | * |
---|
73 | * @param integer $cursorOffset For a PDOStatement object representing a scrollable cursor for which the |
---|
74 | * $cursorOrientation parameter is set to Query::HYDRATE_ORI_ABS, this value specifies |
---|
75 | * the absolute number of the row in the result set that shall be fetched. |
---|
76 | * |
---|
77 | * For a PDOStatement object representing a scrollable cursor for |
---|
78 | * which the $cursorOrientation parameter is set to Query::HYDRATE_ORI_REL, this value |
---|
79 | * specifies the row to fetch relative to the cursor position before |
---|
80 | * PDOStatement->fetch() was called. |
---|
81 | * |
---|
82 | * @return mixed |
---|
83 | */ |
---|
84 | function fetch($fetchStyle = PDO::FETCH_BOTH); |
---|
85 | |
---|
86 | /** |
---|
87 | * Returns an array containing all of the result set rows |
---|
88 | * |
---|
89 | * @param integer $fetchStyle Controls how the next row will be returned to the caller. |
---|
90 | * This value must be one of the Query::HYDRATE_* constants, |
---|
91 | * defaulting to Query::HYDRATE_BOTH |
---|
92 | * |
---|
93 | * @param integer $columnIndex Returns the indicated 0-indexed column when the value of $fetchStyle is |
---|
94 | * Query::HYDRATE_COLUMN. Defaults to 0. |
---|
95 | * |
---|
96 | * @return array |
---|
97 | */ |
---|
98 | function fetchAll($fetchStyle = PDO::FETCH_BOTH); |
---|
99 | |
---|
100 | /** |
---|
101 | * fetchColumn |
---|
102 | * Returns a single column from the next row of a |
---|
103 | * result set or FALSE if there are no more rows. |
---|
104 | * |
---|
105 | * @param integer $columnIndex 0-indexed number of the column you wish to retrieve from the row. If no |
---|
106 | * value is supplied, PDOStatement->fetchColumn() |
---|
107 | * fetches the first column. |
---|
108 | * |
---|
109 | * @return string returns a single column in the next row of a result set. |
---|
110 | */ |
---|
111 | function fetchColumn($columnIndex = 0); |
---|
112 | } |
---|
113 | |
---|