1 | <?php |
||
21 | abstract class AbstractQuery |
||
22 | { |
||
23 | /** |
||
24 | * |
||
25 | * Data to be bound to the query. |
||
26 | * |
||
27 | * @var array |
||
28 | * |
||
29 | */ |
||
30 | protected $bind_values = array(); |
||
31 | |||
32 | /** |
||
33 | * |
||
34 | * The list of WHERE conditions. |
||
35 | * |
||
36 | * @var array |
||
37 | * |
||
38 | */ |
||
39 | protected $where = array(); |
||
40 | |||
41 | /** |
||
42 | * |
||
43 | * ORDER BY these columns. |
||
44 | * |
||
45 | * @var array |
||
46 | * |
||
47 | */ |
||
48 | protected $order_by = array(); |
||
49 | |||
50 | /** |
||
51 | * |
||
52 | * The list of flags. |
||
53 | * |
||
54 | * @var array |
||
55 | * |
||
56 | */ |
||
57 | protected $flags = array(); |
||
58 | |||
59 | /** |
||
60 | * |
||
61 | * A helper for quoting identifier names. |
||
62 | * |
||
63 | * @var Quoter |
||
64 | * |
||
65 | */ |
||
66 | protected $quoter; |
||
67 | |||
68 | /** |
||
69 | * |
||
70 | * Prefix to use on placeholders for "sequential" bound values; used for |
||
71 | * deconfliction when merging bound values from sub-selects, etc. |
||
72 | * |
||
73 | * @var mixed |
||
74 | * |
||
75 | */ |
||
76 | protected $seq_bind_prefix = ''; |
||
77 | |||
78 | /** |
||
79 | * |
||
80 | * Constructor. |
||
81 | * |
||
82 | * @param Quoter $quoter A helper for quoting identifier names. |
||
83 | * |
||
84 | * @param string $seq_bind_prefix A prefix for rewritten sequential-binding |
||
85 | * placeholders (@see getSeqPlaceholder()). |
||
86 | * |
||
87 | */ |
||
88 | 408 | public function __construct(QuoterInterface $quoter, $builder, $seq_bind_prefix = '') |
|
94 | |||
95 | /** |
||
96 | * |
||
97 | * Returns the prefix for rewritten sequential-binding placeholders |
||
98 | * (@see getSeqPlaceholder()). |
||
99 | * |
||
100 | * @return string |
||
101 | * |
||
102 | */ |
||
103 | 1 | public function getSeqBindPrefix() |
|
107 | |||
108 | /** |
||
109 | * |
||
110 | * Returns this query object as an SQL statement string. |
||
111 | * |
||
112 | * @return string |
||
113 | * |
||
114 | */ |
||
115 | 243 | public function __toString() |
|
119 | |||
120 | /** |
||
121 | * |
||
122 | * Returns this query object as an SQL statement string. |
||
123 | * |
||
124 | * @return string |
||
125 | * |
||
126 | */ |
||
127 | 69 | public function getStatement() |
|
131 | |||
132 | /** |
||
133 | * |
||
134 | * Builds this query object into a string. |
||
135 | * |
||
136 | * @return string |
||
137 | * |
||
138 | */ |
||
139 | abstract protected function build(); |
||
140 | |||
141 | /** |
||
142 | * |
||
143 | * Returns the prefix to use when quoting identifier names. |
||
144 | * |
||
145 | * @return string |
||
146 | * |
||
147 | */ |
||
148 | 257 | public function getQuoteNamePrefix() |
|
152 | |||
153 | /** |
||
154 | * |
||
155 | * Returns the suffix to use when quoting identifier names. |
||
156 | * |
||
157 | * @return string |
||
158 | * |
||
159 | */ |
||
160 | 257 | public function getQuoteNameSuffix() |
|
164 | |||
165 | /** |
||
166 | * |
||
167 | * Binds multiple values to placeholders; merges with existing values. |
||
168 | * |
||
169 | * @param array $bind_values Values to bind to placeholders. |
||
170 | * |
||
171 | * @return $this |
||
172 | * |
||
173 | */ |
||
174 | 31 | public function bindValues(array $bind_values) |
|
183 | |||
184 | /** |
||
185 | * |
||
186 | * Binds a single value to the query. |
||
187 | * |
||
188 | * @param string $name The placeholder name or number. |
||
189 | * |
||
190 | * @param mixed $value The value to bind to the placeholder. |
||
191 | * |
||
192 | * @return $this |
||
193 | * |
||
194 | */ |
||
195 | 72 | public function bindValue($name, $value) |
|
200 | |||
201 | /** |
||
202 | * |
||
203 | * Gets the values to bind to placeholders. |
||
204 | * |
||
205 | * @return array |
||
206 | * |
||
207 | */ |
||
208 | 126 | public function getBindValues() |
|
212 | |||
213 | /** |
||
214 | * |
||
215 | * Reset all values bound to named placeholders. |
||
216 | * |
||
217 | * @return $this |
||
218 | * |
||
219 | */ |
||
220 | 15 | public function resetBindValues() |
|
225 | |||
226 | /** |
||
227 | * |
||
228 | * Sets or unsets specified flag. |
||
229 | * |
||
230 | * @param string $flag Flag to set or unset |
||
231 | * |
||
232 | * @param bool $enable Flag status - enabled or not (default true) |
||
233 | * |
||
234 | * @return null |
||
235 | * |
||
236 | */ |
||
237 | 43 | protected function setFlag($flag, $enable = true) |
|
245 | |||
246 | /** |
||
247 | * |
||
248 | * Returns true if the specified flag was enabled by setFlag(). |
||
249 | * |
||
250 | * @param string $flag Flag to check |
||
251 | * |
||
252 | * @return bool |
||
253 | * |
||
254 | */ |
||
255 | 10 | protected function hasFlag($flag) |
|
259 | |||
260 | /** |
||
261 | * |
||
262 | * Reset all query flags. |
||
263 | * |
||
264 | * @return $this |
||
265 | * |
||
266 | */ |
||
267 | 20 | public function resetFlags() |
|
272 | |||
273 | /** |
||
274 | * |
||
275 | * Adds conditions and binds values to a clause. |
||
276 | * |
||
277 | * @param string $clause The clause to work with, typically 'where' or |
||
278 | * 'having'. |
||
279 | * |
||
280 | * @param string $andor Add the condition using this operator, typically |
||
281 | * 'AND' or 'OR'. |
||
282 | * |
||
283 | * @param string $cond The WHERE condition. |
||
284 | |||
285 | * @param array $bind arguments to bind to placeholders |
||
286 | * |
||
287 | * @return null |
||
288 | * |
||
289 | */ |
||
290 | 70 | protected function addClauseCondWithBind($clause, $andor, $cond, $bind) |
|
302 | |||
303 | /** |
||
304 | * |
||
305 | * Rebuilds a condition string, replacing sequential placeholders with |
||
306 | * named placeholders, and binding the sequential values to the named |
||
307 | * placeholders. |
||
308 | * |
||
309 | * @param string $cond The condition with sequential placeholders. |
||
310 | * |
||
311 | * @param array $bind_values The values to bind to the sequential |
||
312 | * placeholders under their named versions. |
||
313 | * |
||
314 | * @return string The rebuilt condition string. |
||
315 | * |
||
316 | */ |
||
317 | 120 | protected function rebuildCondAndBindValues($cond, array $bind_values) |
|
348 | |||
349 | /** |
||
350 | * |
||
351 | * Gets the current sequential placeholder name. |
||
352 | * |
||
353 | * @return string |
||
354 | * |
||
355 | */ |
||
356 | 75 | protected function getSeqPlaceholder() |
|
361 | |||
362 | /** |
||
363 | * |
||
364 | * Adds a column order to the query. |
||
365 | * |
||
366 | * @param array $spec The columns and direction to order by. |
||
367 | * |
||
368 | * @return $this |
||
369 | * |
||
370 | */ |
||
371 | 9 | protected function addOrderBy(array $spec) |
|
378 | } |
||
379 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..