Pdo.php
3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
namespace Phalcon\Db\Result {
/**
* Phalcon\Db\Result\Pdo
*
* Encapsulates the resultset internals
*
* <code>
* $result = $connection->query("SELECT * FROM robots ORDER BY name");
* $result->setFetchMode(Phalcon\Db::FETCH_NUM);
* while ($robot = $result->fetchArray()) {
* print_r($robot);
* }
* </code>
*/
class Pdo {
protected $_connection;
protected $_result;
protected $_fetchMode;
protected $_pdoStatement;
protected $_sqlStatement;
protected $_bindParams;
protected $_bindTypes;
protected $_rowCount;
/**
* \Phalcon\Db\Result\Pdo constructor
*
* @param \Phalcon\Db\AdapterInterface $connection
* @param string $sqlStatement
* @param array $bindParams
* @param array $bindTypes
* @param \PDOStatement $result
*/
public function __construct($connection, $result, $sqlStatement=null, $bindParams=null, $bindTypes=null){ }
/**
* Allows to executes the statement again. Some database systems don't support scrollable cursors,
* So, as cursors are forward only, we need to execute the cursor again to fetch rows from the begining
*
* @return boolean
*/
public function execute(){ }
/**
* Fetches an array/object of strings that corresponds to the fetched row, or FALSE if there are no more rows.
* This method is affected by the active fetch flag set using \Phalcon\Db\Result\Pdo::setFetchMode
*
*<code>
* $result = $connection->query("SELECT * FROM robots ORDER BY name");
* $result->setFetchMode(Phalcon\Db::FETCH_OBJ);
* while ($robot = $result->fetch()) {
* echo $robot->name;
* }
*</code>
*
* @return mixed
*/
public function fetch(){ }
/**
* Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows.
* This method is affected by the active fetch flag set using \Phalcon\Db\Result\Pdo::setFetchMode
*
*<code>
* $result = $connection->query("SELECT * FROM robots ORDER BY name");
* $result->setFetchMode(Phalcon\Db::FETCH_NUM);
* while ($robot = $result->fetchArray()) {
* print_r($robot);
* }
*</code>
*
* @return mixed
*/
public function fetchArray(){ }
/**
* Returns an array of arrays containing all the records in the result
* This method is affected by the active fetch flag set using \Phalcon\Db\Result\Pdo::setFetchMode
*
*<code>
* $result = $connection->query("SELECT * FROM robots ORDER BY name");
* $robots = $result->fetchAll();
*</code>
*
* @return array
*/
public function fetchAll(){ }
/**
* Gets number of rows returned by a resulset
*
*<code>
* $result = $connection->query("SELECT * FROM robots ORDER BY name");
* echo 'There are ', $result->numRows(), ' rows in the resulset';
*</code>
*
* @return int
*/
public function numRows(){ }
/**
* Moves internal resulset cursor to another position letting us to fetch a certain row
*
*<code>
* $result = $connection->query("SELECT * FROM robots ORDER BY name");
* $result->dataSeek(2); // Move to third row on result
* $row = $result->fetch(); // Fetch third row
*</code>
*
* @param int $number
*/
public function dataSeek($number){ }
/**
* Changes the fetching mode affecting \Phalcon\Db\Result\Pdo::fetch()
*
*<code>
* //Return array with integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_NUM);
*
* //Return associative array without integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_ASSOC);
*
* //Return associative array together with integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_BOTH);
*
* //Return an object
* $result->setFetchMode(Phalcon\Db::FETCH_OBJ);
*</code>
*
* @param int $fetchMode
*/
public function setFetchMode($fetchMode){ }
/**
* Gets the internal PDO result object
*
* @return \PDOStatement
*/
public function getInternalResult(){ }
}
}