1 | <?php |
||
14 | abstract class AbstractResultset implements Iterator, Countable |
||
15 | { |
||
16 | /** |
||
17 | * @var \PDOStatement |
||
18 | */ |
||
19 | protected $statement = null; |
||
20 | |||
21 | /** |
||
22 | * @var array Result options |
||
23 | */ |
||
24 | protected $options; |
||
25 | |||
26 | /** |
||
27 | * Is the current complete? |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $rewindComplete = false; |
||
31 | |||
32 | /** |
||
33 | * Is initialized |
||
34 | * @var bool |
||
35 | */ |
||
36 | protected $initialized = false; |
||
37 | |||
38 | /** |
||
39 | * Track current item in recordset |
||
40 | * @var mixed |
||
41 | */ |
||
42 | protected $currentData = false; |
||
43 | |||
44 | /** |
||
45 | * Current position of scrollable statement |
||
46 | * @var int |
||
47 | */ |
||
48 | protected $position = -1; |
||
49 | |||
50 | /** |
||
51 | * @var int |
||
52 | */ |
||
53 | protected $rowCount = null; |
||
54 | |||
55 | /** |
||
56 | * @var array |
||
57 | */ |
||
58 | protected $fields = null; |
||
59 | |||
60 | /** |
||
61 | * Initialize |
||
62 | * |
||
63 | * @return void |
||
64 | */ |
||
65 | 4 | public function initialize() |
|
69 | |||
70 | /** |
||
71 | * Get statement |
||
72 | * |
||
73 | * @throws RuntimeException |
||
74 | * @return mixed |
||
75 | */ |
||
76 | 9 | public function getStatement() |
|
84 | |||
85 | /** |
||
86 | * Get the data |
||
87 | * |
||
88 | * @return mixed |
||
89 | */ |
||
90 | 7 | public function current() |
|
94 | |||
95 | /** |
||
96 | * Next |
||
97 | * |
||
98 | * @throws RuntimeException |
||
99 | * @return mixed |
||
100 | */ |
||
101 | 1 | public function next() |
|
106 | |||
107 | /** |
||
108 | * Fetch |
||
109 | * |
||
110 | * @throws RuntimeException |
||
111 | * @return array |
||
112 | */ |
||
113 | 6 | private function fetch() |
|
117 | |||
118 | |||
119 | /** |
||
120 | * Key |
||
121 | * |
||
122 | * @return mixed |
||
123 | */ |
||
124 | 1 | public function key() |
|
128 | |||
129 | /** |
||
130 | * Reset interator |
||
131 | * |
||
132 | * @throws RuntimeException |
||
133 | * @return void |
||
134 | */ |
||
135 | 5 | public function rewind() |
|
150 | |||
151 | /** |
||
152 | * Valid |
||
153 | * |
||
154 | * @return bool |
||
155 | */ |
||
156 | 1 | public function valid() |
|
160 | |||
161 | /** |
||
162 | * Count |
||
163 | * |
||
164 | * @throws RuntimeException |
||
165 | * @return int |
||
166 | */ |
||
167 | 1 | public function count() |
|
177 | |||
178 | /** |
||
179 | * Fields |
||
180 | * |
||
181 | * @throws RuntimeException |
||
182 | * @return array |
||
183 | */ |
||
184 | 2 | public function getFields() |
|
208 | |||
209 | /** |
||
210 | * Return numbers de fields |
||
211 | * |
||
212 | * @throws RuntimeException |
||
213 | * @return int |
||
214 | */ |
||
215 | 2 | public function getFieldCount() |
|
219 | } |
||
220 |