|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace LeKoala\DebugBar\Proxy; |
|
4
|
|
|
|
|
5
|
|
|
use LeKoala\DebugBar\DebugBar; |
|
6
|
|
|
use SqlFormatter; |
|
7
|
|
|
use SilverStripe\Control\Controller; |
|
8
|
|
|
use SilverStripe\Control\Director; |
|
9
|
|
|
use SilverStripe\Dev\Debug; |
|
10
|
|
|
use SilverStripe\ORM\Connect\Database; |
|
11
|
|
|
use SilverStripe\ORM\Connect\DBConnector; |
|
12
|
|
|
use SilverStripe\ORM\Connect\DBSchemaManager; |
|
13
|
|
|
use SilverStripe\ORM\Connect\DBQueryBuilder; |
|
14
|
|
|
use SilverStripe\ORM\DataList; |
|
15
|
|
|
use SilverStripe\ORM\DataObject; |
|
16
|
|
|
use SilverStripe\ORM\DataQuery; |
|
17
|
|
|
use SilverStripe\ORM\DB; |
|
18
|
|
|
use SilverStripe\ORM\ListDecorator; |
|
19
|
|
|
use SilverStripe\ORM\Map; |
|
20
|
|
|
use SilverStripe\ORM\Queries\SQLExpression; |
|
21
|
|
|
use SilverStripe\ORM\Queries\SQLSelect; |
|
22
|
|
|
use SilverStripe\View\SSViewer; |
|
23
|
|
|
use SilverStripe\View\SSViewer_DataPresenter; |
|
24
|
|
|
use SilverStripe\View\SSViewer_Scope; |
|
25
|
|
|
use SilverStripe\View\ViewableData; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* A proxy database to log queries |
|
29
|
|
|
* |
|
30
|
|
|
* @author Koala |
|
31
|
|
|
*/ |
|
32
|
|
|
class DatabaseProxy extends Database |
|
33
|
|
|
{ |
|
34
|
|
|
/** @var MySQLDatabase */ |
|
35
|
|
|
protected $realConn; |
|
36
|
|
|
protected $findSource; |
|
37
|
|
|
|
|
38
|
|
|
/** @var array */ |
|
39
|
|
|
protected $queries; |
|
40
|
|
|
protected $connector; |
|
41
|
|
|
protected $schemaManager; |
|
42
|
|
|
protected $queryBuilder; |
|
43
|
|
|
protected $showQueries = false; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param Database|array $realConn |
|
47
|
|
|
*/ |
|
48
|
|
|
public function __construct($realConn) |
|
49
|
|
|
{ |
|
50
|
|
|
$this->realConn = $realConn; |
|
|
|
|
|
|
51
|
|
|
$this->connector = $realConn->getConnector(); |
|
|
|
|
|
|
52
|
|
|
$this->schemaManager = $realConn->getSchemaManager(); |
|
53
|
|
|
$this->queryBuilder = $realConn->getQueryBuilder(); |
|
54
|
|
|
$this->queries = array(); |
|
55
|
|
|
$this->findSource = DebugBar::config()->find_source; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function getShowQueries() |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->showQueries; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function setShowQueries($showQueries) |
|
64
|
|
|
{ |
|
65
|
|
|
$this->showQueries = $showQueries; |
|
66
|
|
|
return $this; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Get the current connector |
|
71
|
|
|
* |
|
72
|
|
|
* @return DBConnector |
|
73
|
|
|
*/ |
|
74
|
|
|
public function getConnector() |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->realConn->getConnector(); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Injector injection point for connector dependency |
|
81
|
|
|
* |
|
82
|
|
|
* @param DBConnector $connector |
|
83
|
|
|
*/ |
|
84
|
|
|
public function setConnector(DBConnector $connector) |
|
85
|
|
|
{ |
|
86
|
|
|
parent::setConnector($connector); |
|
87
|
|
|
$this->realConn->setConnector($connector); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Returns the current schema manager |
|
92
|
|
|
* |
|
93
|
|
|
* @return DBSchemaManager |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getSchemaManager() |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->realConn->getSchemaManager(); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Injector injection point for schema manager |
|
102
|
|
|
* |
|
103
|
|
|
* @param DBSchemaManager $schemaManager |
|
104
|
|
|
*/ |
|
105
|
|
|
public function setSchemaManager(DBSchemaManager $schemaManager) |
|
106
|
|
|
{ |
|
107
|
|
|
parent::setSchemaManager($schemaManager); |
|
108
|
|
|
$this->realConn->setSchemaManager($schemaManager); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Returns the current query builder |
|
113
|
|
|
* |
|
114
|
|
|
* @return DBQueryBuilder |
|
115
|
|
|
*/ |
|
116
|
|
|
public function getQueryBuilder() |
|
117
|
|
|
{ |
|
118
|
|
|
return $this->realConn->getQueryBuilder(); |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* Injector injection point for schema manager |
|
123
|
|
|
* |
|
124
|
|
|
* @param DBQueryBuilder $queryBuilder |
|
125
|
|
|
*/ |
|
126
|
|
|
public function setQueryBuilder(DBQueryBuilder $queryBuilder) |
|
127
|
|
|
{ |
|
128
|
|
|
parent::setQueryBuilder($queryBuilder); |
|
129
|
|
|
$this->realConn->setQueryBuilder($queryBuilder); |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* Determines if the query should be previewed, and thus interrupted silently. |
|
134
|
|
|
* If so, this function also displays the query via the debuging system. |
|
135
|
|
|
* Subclasess should respect the results of this call for each query, and not |
|
136
|
|
|
* execute any queries that generate a true response. |
|
137
|
|
|
* |
|
138
|
|
|
* @param string $sql The query to be executed |
|
139
|
|
|
* @return boolean Flag indicating that the query was previewed |
|
140
|
|
|
*/ |
|
141
|
|
|
protected function previewWrite($sql) |
|
|
|
|
|
|
142
|
|
|
{ |
|
143
|
|
|
// Only preview if previewWrite is set, we are in dev mode, and |
|
144
|
|
|
// the query is mutable |
|
145
|
|
|
if (isset($_REQUEST['previewwrite']) && Director::isDev() && $this->connector->isQueryMutable($sql) |
|
146
|
|
|
) { |
|
147
|
|
|
// output preview message |
|
148
|
|
|
Debug::message("Will execute: $sql"); |
|
149
|
|
|
return true; |
|
150
|
|
|
} else { |
|
151
|
|
|
return false; |
|
152
|
|
|
} |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* Allows the display and benchmarking of queries as they are being run |
|
157
|
|
|
* |
|
158
|
|
|
* @param string $sql Query to run, and single parameter to callback |
|
159
|
|
|
* @param callable $callback Callback to execute code |
|
160
|
|
|
* @param array $parameters |
|
161
|
|
|
* @return mixed Result of query |
|
162
|
|
|
*/ |
|
163
|
|
|
protected function benchmarkQuery($sql, $callback, $parameters = array()) |
|
164
|
|
|
{ |
|
165
|
|
|
$starttime = microtime(true); |
|
166
|
|
|
$startmemory = memory_get_usage(true); |
|
167
|
|
|
|
|
168
|
|
|
if (is_array($sql)) { |
|
169
|
|
|
$parameters = $sql[1]; |
|
170
|
|
|
$sql = $sql[0]; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
if ($this->showQueries && Director::isDev()) { |
|
174
|
|
|
$starttime = microtime(true); |
|
175
|
|
|
$result = $callback($sql); |
|
176
|
|
|
$endtime = round(microtime(true) - $starttime, 4); |
|
177
|
|
|
|
|
178
|
|
|
$formattedSql = SqlFormatter::format($sql); |
|
179
|
|
|
$rows = $result->numRecords(); |
|
180
|
|
|
echo '<pre>The following query took <b>'.$endtime.'</b>s an returned <b>'.$rows."</b> row(s) \n"; |
|
181
|
|
|
echo 'Triggered by: <i>'.$this->findSource().'</i></pre>'; |
|
182
|
|
|
echo $formattedSql; |
|
183
|
|
|
|
|
184
|
|
|
$results = iterator_to_array($result); |
|
185
|
|
|
if ($rows > 0) { |
|
186
|
|
|
if ($rows == 1) { |
|
187
|
|
|
dump($results[0]); |
|
188
|
|
|
} else { |
|
189
|
|
|
$linearValues = count($results[0]); |
|
190
|
|
|
if ($linearValues) { |
|
191
|
|
|
dump(implode( |
|
192
|
|
|
',', |
|
193
|
|
|
array_map( |
|
194
|
|
|
function ($item) { |
|
195
|
|
|
return $item[key($item)]; |
|
196
|
|
|
}, |
|
197
|
|
|
$results |
|
198
|
|
|
) |
|
199
|
|
|
)); |
|
200
|
|
|
} else { |
|
201
|
|
|
if ($rows < 20) { |
|
202
|
|
|
dump($results); |
|
203
|
|
|
} else { |
|
204
|
|
|
dump("Too many results to display"); |
|
205
|
|
|
} |
|
206
|
|
|
} |
|
207
|
|
|
} |
|
208
|
|
|
} |
|
209
|
|
|
echo '<hr/>'; |
|
210
|
|
|
|
|
211
|
|
|
$handle = $result; |
|
212
|
|
|
$handle->rewind(); // Rewind the results |
|
213
|
|
|
} else { |
|
214
|
|
|
/* @var $handle PDOQuery */ |
|
215
|
|
|
$handle = $callback($sql); |
|
216
|
|
|
} |
|
217
|
|
|
$endtime = microtime(true); |
|
218
|
|
|
$endmemory = memory_get_usage(true); |
|
219
|
|
|
|
|
220
|
|
|
$rawsql = $sql; |
|
221
|
|
|
|
|
222
|
|
|
// Prepared query are not so readable |
|
223
|
|
|
if (!empty($parameters)) { |
|
224
|
|
|
foreach ($parameters as $param) { |
|
225
|
|
|
$pos = strpos($sql, '?'); |
|
226
|
|
|
if ($pos !== false) { |
|
227
|
|
|
$param = '"'.$param.'"'; |
|
228
|
|
|
$sql = substr_replace($sql, $param, $pos, 1); |
|
229
|
|
|
} |
|
230
|
|
|
} |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
|
|
234
|
|
|
// Sometimes, ugly spaces are there |
|
235
|
|
|
$sql = preg_replace('/[[:blank:]]+/', ' ', trim($sql)); |
|
236
|
|
|
|
|
237
|
|
|
$shortsql = $sql; |
|
238
|
|
|
|
|
239
|
|
|
// Sometimes, the select statement can be very long and unreadable |
|
240
|
|
|
$matches = null; |
|
241
|
|
|
preg_match_all('/SELECT(.+?) FROM/is', $sql, $matches); |
|
242
|
|
|
$select = empty($matches[1]) ? null : trim($matches[1][0]); |
|
243
|
|
|
if (strlen($select) > 100) { |
|
244
|
|
|
$shortsql = str_replace($select, '"ClickToShowFields"', $sql); |
|
245
|
|
|
} else { |
|
246
|
|
|
$select = null; |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
$this->queries[] = array( |
|
250
|
|
|
'raw_query' => $rawsql, |
|
251
|
|
|
'short_query' => $shortsql, |
|
252
|
|
|
'select' => $select, |
|
253
|
|
|
'query' => $sql, |
|
254
|
|
|
'start_time' => $starttime, |
|
255
|
|
|
'end_time' => $endtime, |
|
256
|
|
|
'duration' => $endtime - $starttime, |
|
257
|
|
|
'memory' => $endmemory - $startmemory, |
|
258
|
|
|
'rows' => $handle ? $handle->numRecords() : null, |
|
259
|
|
|
'success' => $handle ? true : false, |
|
260
|
|
|
'database' => $this->getSelectedDatabase(), |
|
261
|
|
|
'source' => $this->findSource ? $this->findSource() : null |
|
262
|
|
|
); |
|
263
|
|
|
return $handle; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
protected function findSource() |
|
267
|
|
|
{ |
|
268
|
|
|
$traces = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT); |
|
269
|
|
|
|
|
270
|
|
|
// Not relevant to determine source |
|
271
|
|
|
$internalClasses = array( |
|
272
|
|
|
DB::class, SQLExpression::class, DataList::class, DataObject::class, |
|
273
|
|
|
DataQuery::class, SQLSelect::class, 'SQLQuery', Map::class, ListDecorator::class, 'Object' |
|
274
|
|
|
); |
|
275
|
|
|
|
|
276
|
|
|
$viewerClasses = array( |
|
277
|
|
|
SSViewer_DataPresenter::class, SSViewer_Scope::class, SSViewer::class, |
|
278
|
|
|
ViewableData::class |
|
279
|
|
|
); |
|
280
|
|
|
|
|
281
|
|
|
$sources = array(); |
|
282
|
|
|
foreach ($traces as $trace) { |
|
283
|
|
|
$class = isset($trace['class']) ? $trace['class'] : null; |
|
284
|
|
|
$line = isset($trace['line']) ? $trace['line'] : null; |
|
285
|
|
|
$function = isset($trace['function']) ? $trace['function'] : null; |
|
286
|
|
|
$type = isset($trace['type']) ? $trace['type'] : '::'; |
|
287
|
|
|
|
|
288
|
|
|
/* @var $object SSViewer */ |
|
289
|
|
|
$object = isset($trace['object']) ? $trace['object'] : null; |
|
290
|
|
|
|
|
291
|
|
|
if (!$class) { |
|
292
|
|
|
continue; |
|
293
|
|
|
} |
|
294
|
|
|
if ($function && $function == '{closure}') { |
|
295
|
|
|
continue; |
|
296
|
|
|
} |
|
297
|
|
|
if (strpos($class, DebugBar::class) === 0) { |
|
298
|
|
|
continue; |
|
299
|
|
|
} |
|
300
|
|
|
if (in_array($class, $internalClasses)) { |
|
301
|
|
|
continue; |
|
302
|
|
|
} |
|
303
|
|
|
if (in_array($class, $viewerClasses)) { |
|
304
|
|
|
if ($function == 'includeGeneratedTemplate') { |
|
305
|
|
|
$templates = $object->templates(); |
|
306
|
|
|
|
|
307
|
|
|
$template = null; |
|
308
|
|
|
if (isset($templates['main'])) { |
|
309
|
|
|
$template = basename($templates['main']); |
|
310
|
|
|
} else { |
|
311
|
|
|
$keys = array_keys($templates); |
|
312
|
|
|
$key = reset($keys); |
|
313
|
|
|
if (isset($templates[$key])) { |
|
314
|
|
|
$template = $key.':'.basename($templates[$key]); |
|
315
|
|
|
} |
|
316
|
|
|
} |
|
317
|
|
|
if (!empty($template)) { |
|
318
|
|
|
$sources[] = $template; |
|
319
|
|
|
} |
|
320
|
|
|
} |
|
321
|
|
|
continue; |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
$name = $class; |
|
325
|
|
|
if ($function) { |
|
326
|
|
|
$name .= $type.$function; |
|
327
|
|
|
} |
|
328
|
|
|
if ($line) { |
|
329
|
|
|
$name .= ':'.$line; |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
$sources[] = $name; |
|
333
|
|
|
|
|
334
|
|
|
if (count($sources) > 3) { |
|
335
|
|
|
break; |
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
|
|
339
|
|
|
// We reached a Controller, exit loop |
|
340
|
|
|
if ($object && $object instanceof Controller) { |
|
341
|
|
|
break; |
|
342
|
|
|
} |
|
343
|
|
|
} |
|
344
|
|
|
|
|
345
|
|
|
if (empty($sources)) { |
|
346
|
|
|
return 'Undefined source'; |
|
347
|
|
|
} |
|
348
|
|
|
return implode(' > ', $sources); |
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
/** |
|
352
|
|
|
* Execute the given SQL query. |
|
353
|
|
|
* |
|
354
|
|
|
* @param string $sql The SQL query to execute |
|
355
|
|
|
* @param int $errorLevel The level of error reporting to enable for the query |
|
356
|
|
|
* @return SS_Query |
|
357
|
|
|
*/ |
|
358
|
|
|
public function query($sql, $errorLevel = E_USER_ERROR) |
|
359
|
|
|
{ |
|
360
|
|
|
// Check if we should only preview this query |
|
361
|
|
|
if ($this->previewWrite($sql)) { |
|
362
|
|
|
return; |
|
363
|
|
|
} |
|
364
|
|
|
|
|
365
|
|
|
if (!$this->connector) { |
|
366
|
|
|
$self = $this; |
|
367
|
|
|
return $this->benchmarkQuery( |
|
368
|
|
|
$sql, |
|
369
|
|
|
function ($sql) use ($self, $errorLevel) { |
|
370
|
|
|
return $self->oldQuery($sql, $errorLevel); |
|
371
|
|
|
} |
|
372
|
|
|
); |
|
373
|
|
|
} |
|
374
|
|
|
|
|
375
|
|
|
// Benchmark query |
|
376
|
|
|
$connector = $this->connector; |
|
377
|
|
|
return $this->benchmarkQuery( |
|
378
|
|
|
$sql, |
|
379
|
|
|
function ($sql) use ($connector, $errorLevel) { |
|
380
|
|
|
return $connector->query($sql, $errorLevel); |
|
381
|
|
|
} |
|
382
|
|
|
); |
|
383
|
|
|
} |
|
384
|
|
|
|
|
385
|
|
|
public function oldQuery($sql, $errorLevel = E_USER_ERROR) |
|
386
|
|
|
{ |
|
387
|
|
|
return $this->realConn->query($sql, $errorLevel); |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
/** |
|
391
|
|
|
* Execute the given SQL parameterised query with the specified arguments |
|
392
|
|
|
* |
|
393
|
|
|
* @param string $sql The SQL query to execute. The ? character will denote parameters. |
|
394
|
|
|
* @param array $parameters An ordered list of arguments. |
|
395
|
|
|
* @param int $errorLevel The level of error reporting to enable for the query |
|
396
|
|
|
* @return SS_Query |
|
397
|
|
|
*/ |
|
398
|
|
|
public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR) |
|
399
|
|
|
{ |
|
400
|
|
|
// Check if we should only preview this query |
|
401
|
|
|
if ($this->previewWrite($sql)) { |
|
402
|
|
|
return; |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
// Benchmark query |
|
406
|
|
|
$connector = $this->connector; |
|
407
|
|
|
return $this->benchmarkQuery( |
|
408
|
|
|
array($sql, $parameters), |
|
|
|
|
|
|
409
|
|
|
function ($sql) use ($connector, $parameters, $errorLevel) { |
|
410
|
|
|
return $connector->preparedQuery($sql, $parameters, $errorLevel); |
|
411
|
|
|
} |
|
412
|
|
|
); |
|
413
|
|
|
} |
|
414
|
|
|
|
|
415
|
|
|
/** |
|
416
|
|
|
* @return array |
|
417
|
|
|
*/ |
|
418
|
|
|
public function getQueries() |
|
419
|
|
|
{ |
|
420
|
|
|
return $this->queries; |
|
421
|
|
|
} |
|
422
|
|
|
|
|
423
|
|
|
/** |
|
424
|
|
|
* @param string $name |
|
425
|
|
|
* @param array $arguments |
|
426
|
|
|
* @return mixed |
|
427
|
|
|
*/ |
|
428
|
|
|
public function __call($name, $arguments) |
|
429
|
|
|
{ |
|
430
|
|
|
return call_user_func_array(array($this->realConn, $name), $arguments); |
|
431
|
|
|
} |
|
432
|
|
|
|
|
433
|
|
|
public function addslashes($val) |
|
|
|
|
|
|
434
|
|
|
{ |
|
435
|
|
|
return call_user_func_array( |
|
436
|
|
|
array($this->realConn, __FUNCTION__), |
|
437
|
|
|
func_get_args() |
|
438
|
|
|
); |
|
439
|
|
|
} |
|
440
|
|
|
|
|
441
|
|
View Code Duplication |
public function alterTable( |
|
|
|
|
|
|
442
|
|
|
$table, |
|
|
|
|
|
|
443
|
|
|
$newFields = null, |
|
|
|
|
|
|
444
|
|
|
$newIndexes = null, |
|
|
|
|
|
|
445
|
|
|
$alteredFields = null, |
|
|
|
|
|
|
446
|
|
|
$alteredIndexes = null, |
|
|
|
|
|
|
447
|
|
|
$alteredOptions = null, |
|
|
|
|
|
|
448
|
|
|
$advancedOptions = null |
|
|
|
|
|
|
449
|
|
|
) { |
|
450
|
|
|
return call_user_func_array( |
|
451
|
|
|
array($this->realConn, __FUNCTION__), |
|
452
|
|
|
func_get_args() |
|
453
|
|
|
); |
|
454
|
|
|
} |
|
455
|
|
|
|
|
456
|
|
View Code Duplication |
public function comparisonClause( |
|
|
|
|
|
|
457
|
|
|
$field, |
|
458
|
|
|
$value, |
|
459
|
|
|
$exact = false, |
|
460
|
|
|
$negate = false, |
|
461
|
|
|
$caseSensitive = false, |
|
462
|
|
|
$parameterised = false |
|
463
|
|
|
) { |
|
464
|
|
|
return call_user_func_array( |
|
465
|
|
|
array($this->realConn, __FUNCTION__), |
|
466
|
|
|
func_get_args() |
|
467
|
|
|
); |
|
468
|
|
|
} |
|
469
|
|
|
|
|
470
|
|
|
public function createDatabase() |
|
471
|
|
|
{ |
|
472
|
|
|
return call_user_func_array( |
|
473
|
|
|
array($this->realConn, __FUNCTION__), |
|
474
|
|
|
func_get_args() |
|
475
|
|
|
); |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
|
|
public function createField($table, $field, $spec) |
|
|
|
|
|
|
479
|
|
|
{ |
|
480
|
|
|
return call_user_func_array( |
|
481
|
|
|
array($this->realConn, __FUNCTION__), |
|
482
|
|
|
func_get_args() |
|
483
|
|
|
); |
|
484
|
|
|
} |
|
485
|
|
|
|
|
486
|
|
View Code Duplication |
public function createTable( |
|
|
|
|
|
|
487
|
|
|
$table, |
|
|
|
|
|
|
488
|
|
|
$fields = null, |
|
|
|
|
|
|
489
|
|
|
$indexes = null, |
|
|
|
|
|
|
490
|
|
|
$options = null, |
|
|
|
|
|
|
491
|
|
|
$advancedOptions = null |
|
|
|
|
|
|
492
|
|
|
) { |
|
493
|
|
|
return call_user_func_array( |
|
494
|
|
|
array($this->realConn, __FUNCTION__), |
|
495
|
|
|
func_get_args() |
|
496
|
|
|
); |
|
497
|
|
|
} |
|
498
|
|
|
|
|
499
|
|
|
public function datetimeDifferenceClause($date1, $date2) |
|
500
|
|
|
{ |
|
501
|
|
|
return call_user_func_array( |
|
502
|
|
|
array($this->realConn, __FUNCTION__), |
|
503
|
|
|
func_get_args() |
|
504
|
|
|
); |
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
public function datetimeIntervalClause($date, $interval) |
|
508
|
|
|
{ |
|
509
|
|
|
return call_user_func_array( |
|
510
|
|
|
array($this->realConn, __FUNCTION__), |
|
511
|
|
|
func_get_args() |
|
512
|
|
|
); |
|
513
|
|
|
} |
|
514
|
|
|
|
|
515
|
|
|
public function enumValuesForField($tableName, $fieldName) |
|
|
|
|
|
|
516
|
|
|
{ |
|
517
|
|
|
return call_user_func_array( |
|
518
|
|
|
array($this->realConn, __FUNCTION__), |
|
519
|
|
|
func_get_args() |
|
520
|
|
|
); |
|
521
|
|
|
} |
|
522
|
|
|
|
|
523
|
|
|
public function fieldList($table) |
|
|
|
|
|
|
524
|
|
|
{ |
|
525
|
|
|
return call_user_func_array( |
|
526
|
|
|
array($this->realConn, __FUNCTION__), |
|
527
|
|
|
func_get_args() |
|
528
|
|
|
); |
|
529
|
|
|
} |
|
530
|
|
|
|
|
531
|
|
|
public function formattedDatetimeClause($date, $format) |
|
532
|
|
|
{ |
|
533
|
|
|
return call_user_func_array( |
|
534
|
|
|
array($this->realConn, __FUNCTION__), |
|
535
|
|
|
func_get_args() |
|
536
|
|
|
); |
|
537
|
|
|
} |
|
538
|
|
|
|
|
539
|
|
|
public function getConnect($parameters) |
|
|
|
|
|
|
540
|
|
|
{ |
|
541
|
|
|
return call_user_func_array( |
|
542
|
|
|
array($this->realConn, __FUNCTION__), |
|
543
|
|
|
func_get_args() |
|
544
|
|
|
); |
|
545
|
|
|
} |
|
546
|
|
|
|
|
547
|
|
|
public function getGeneratedID($table) |
|
548
|
|
|
{ |
|
549
|
|
|
return call_user_func_array( |
|
550
|
|
|
array($this->realConn, __FUNCTION__), |
|
551
|
|
|
func_get_args() |
|
552
|
|
|
); |
|
553
|
|
|
} |
|
554
|
|
|
|
|
555
|
|
|
public function hasTable($tableName) |
|
|
|
|
|
|
556
|
|
|
{ |
|
557
|
|
|
return call_user_func_array( |
|
558
|
|
|
array($this->realConn, __FUNCTION__), |
|
559
|
|
|
func_get_args() |
|
560
|
|
|
); |
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
public function isActive() |
|
564
|
|
|
{ |
|
565
|
|
|
return call_user_func_array( |
|
566
|
|
|
array($this->realConn, __FUNCTION__), |
|
567
|
|
|
func_get_args() |
|
568
|
|
|
); |
|
569
|
|
|
} |
|
570
|
|
|
|
|
571
|
|
|
public function renameField($tableName, $oldName, $newName) |
|
|
|
|
|
|
572
|
|
|
{ |
|
573
|
|
|
return call_user_func_array( |
|
574
|
|
|
array($this->realConn, __FUNCTION__), |
|
575
|
|
|
func_get_args() |
|
576
|
|
|
); |
|
577
|
|
|
} |
|
578
|
|
|
|
|
579
|
|
|
public function renameTable($oldTableName, $newTableName) |
|
|
|
|
|
|
580
|
|
|
{ |
|
581
|
|
|
return call_user_func_array( |
|
582
|
|
|
array($this->realConn, __FUNCTION__), |
|
583
|
|
|
func_get_args() |
|
584
|
|
|
); |
|
585
|
|
|
} |
|
586
|
|
|
|
|
587
|
|
|
public function supportsTimezoneOverride() |
|
588
|
|
|
{ |
|
589
|
|
|
return call_user_func_array( |
|
590
|
|
|
array($this->realConn, __FUNCTION__), |
|
591
|
|
|
func_get_args() |
|
592
|
|
|
); |
|
593
|
|
|
} |
|
594
|
|
|
|
|
595
|
|
|
public function supportsTransactions() |
|
596
|
|
|
{ |
|
597
|
|
|
return call_user_func_array( |
|
598
|
|
|
array($this->realConn, __FUNCTION__), |
|
599
|
|
|
func_get_args() |
|
600
|
|
|
); |
|
601
|
|
|
} |
|
602
|
|
|
|
|
603
|
|
|
public function tableList() |
|
604
|
|
|
{ |
|
605
|
|
|
return call_user_func_array( |
|
606
|
|
|
array($this->realConn, __FUNCTION__), |
|
607
|
|
|
func_get_args() |
|
608
|
|
|
); |
|
609
|
|
|
} |
|
610
|
|
|
|
|
611
|
|
|
public function transactionEnd($chain = false) |
|
612
|
|
|
{ |
|
613
|
|
|
return call_user_func_array( |
|
614
|
|
|
array($this->realConn, __FUNCTION__), |
|
615
|
|
|
func_get_args() |
|
616
|
|
|
); |
|
617
|
|
|
} |
|
618
|
|
|
|
|
619
|
|
|
public function transactionRollback($savepoint = false) |
|
620
|
|
|
{ |
|
621
|
|
|
return call_user_func_array( |
|
622
|
|
|
array($this->realConn, __FUNCTION__), |
|
623
|
|
|
func_get_args() |
|
624
|
|
|
); |
|
625
|
|
|
} |
|
626
|
|
|
|
|
627
|
|
|
public function transactionSavepoint($savepoint) |
|
628
|
|
|
{ |
|
629
|
|
|
return call_user_func_array( |
|
630
|
|
|
array($this->realConn, __FUNCTION__), |
|
631
|
|
|
func_get_args() |
|
632
|
|
|
); |
|
633
|
|
|
} |
|
634
|
|
|
|
|
635
|
|
|
public function transactionStart($transaction_mode = false, $session_characteristics = false) |
|
636
|
|
|
{ |
|
637
|
|
|
return call_user_func_array( |
|
638
|
|
|
array($this->realConn, __FUNCTION__), |
|
639
|
|
|
func_get_args() |
|
640
|
|
|
); |
|
641
|
|
|
} |
|
642
|
|
|
|
|
643
|
|
|
public function clearTable($table) |
|
644
|
|
|
{ |
|
645
|
|
|
return call_user_func_array( |
|
646
|
|
|
array($this->realConn, __FUNCTION__), |
|
647
|
|
|
func_get_args() |
|
648
|
|
|
); |
|
649
|
|
|
} |
|
650
|
|
|
|
|
651
|
|
|
public function getDatabaseServer() |
|
652
|
|
|
{ |
|
653
|
|
|
return call_user_func_array( |
|
654
|
|
|
array($this->realConn, __FUNCTION__), |
|
655
|
|
|
func_get_args() |
|
656
|
|
|
); |
|
657
|
|
|
} |
|
658
|
|
|
|
|
659
|
|
|
public function now() |
|
660
|
|
|
{ |
|
661
|
|
|
return call_user_func_array( |
|
662
|
|
|
array($this->realConn, __FUNCTION__), |
|
663
|
|
|
func_get_args() |
|
664
|
|
|
); |
|
665
|
|
|
} |
|
666
|
|
|
|
|
667
|
|
|
public function random() |
|
668
|
|
|
{ |
|
669
|
|
|
return call_user_func_array( |
|
670
|
|
|
array($this->realConn, __FUNCTION__), |
|
671
|
|
|
func_get_args() |
|
672
|
|
|
); |
|
673
|
|
|
} |
|
674
|
|
|
|
|
675
|
|
|
public function searchEngine( |
|
676
|
|
|
$classesToSearch, |
|
677
|
|
|
$keywords, |
|
678
|
|
|
$start, |
|
679
|
|
|
$pageLength, |
|
680
|
|
|
$sortBy = "Relevance DESC", |
|
681
|
|
|
$extraFilter = "", |
|
682
|
|
|
$booleanSearch = false, |
|
683
|
|
|
$alternativeFileFilter = "", |
|
684
|
|
|
$invertedMatch = false |
|
685
|
|
|
) { |
|
686
|
|
|
return call_user_func_array( |
|
687
|
|
|
array($this->realConn, __FUNCTION__), |
|
688
|
|
|
func_get_args() |
|
689
|
|
|
); |
|
690
|
|
|
} |
|
691
|
|
|
|
|
692
|
|
|
public function supportsCollations() |
|
693
|
|
|
{ |
|
694
|
|
|
return call_user_func_array( |
|
695
|
|
|
array($this->realConn, __FUNCTION__), |
|
696
|
|
|
func_get_args() |
|
697
|
|
|
); |
|
698
|
|
|
} |
|
699
|
|
|
} |
|
700
|
|
|
|
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..