Completed
Pull Request — master (#47)
by Robbie
01:29
created

DatabaseProxy::fieldList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
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;
0 ignored issues
show
Documentation Bug introduced by
It seems like $realConn of type object<SilverStripe\ORM\Connect\Database> or array is incompatible with the declared type object<LeKoala\DebugBar\Proxy\MySQLDatabase> of property $realConn.

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..

Loading history...
51
        $this->connector     = $realConn->getConnector();
0 ignored issues
show
Bug introduced by
It seems like $realConn is not always an object, but can also be of type array. Maybe add an additional type check?

If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:

function someFunction(A $objectMaybe = null)
{
    if ($objectMaybe instanceof A) {
        $objectMaybe->doSomething();
    }
}
Loading history...
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)
0 ignored issues
show
Coding Style introduced by
previewWrite uses the super-global variable $_REQUEST which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
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
            return $this->benchmarkQuery(
367
                $sql,
368
                function ($sql) use ($errorLevel) {
369
                    return $this->oldQuery($sql, $errorLevel);
370
                }
371
            );
372
        }
373
374
        // Benchmark query
375
        return $this->benchmarkQuery(
376
            $sql,
377
            function ($sql) use ($errorLevel) {
378
                return $this->connector->query($sql, $errorLevel);
379
            }
380
        );
381
    }
382
383
    public function oldQuery($sql, $errorLevel = E_USER_ERROR)
384
    {
385
        return $this->realConn->query($sql, $errorLevel);
386
    }
387
388
    /**
389
     * Execute the given SQL parameterised query with the specified arguments
390
     *
391
     * @param string $sql The SQL query to execute. The ? character will denote parameters.
392
     * @param array $parameters An ordered list of arguments.
393
     * @param int $errorLevel The level of error reporting to enable for the query
394
     * @return SS_Query
395
     */
396
    public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR)
397
    {
398
        // Check if we should only preview this query
399
        if ($this->previewWrite($sql)) {
400
            return;
401
        }
402
403
        // Benchmark query
404
        $connector = $this->connector;
405
        return $this->benchmarkQuery(
406
            array($sql, $parameters),
0 ignored issues
show
Documentation introduced by
array($sql, $parameters) is of type array<integer,string|arr...:"string","1":"array"}>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
407
            function ($sql) use ($connector, $parameters, $errorLevel) {
408
                return $connector->preparedQuery($sql, $parameters, $errorLevel);
409
            }
410
        );
411
    }
412
413
    /**
414
     * @return array
415
     */
416
    public function getQueries()
417
    {
418
        return $this->queries;
419
    }
420
421
    /**
422
     * @param string $name
423
     * @param array $arguments
424
     * @return mixed
425
     */
426
    public function __call($name, $arguments)
427
    {
428
        return call_user_func_array(array($this->realConn, $name), $arguments);
429
    }
430
431
    public function addslashes($val)
0 ignored issues
show
Unused Code introduced by
The parameter $val is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
432
    {
433
        return call_user_func_array(
434
            array($this->realConn, __FUNCTION__),
435
            func_get_args()
436
        );
437
    }
438
439 View Code Duplication
    public function alterTable(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
440
        $table,
0 ignored issues
show
Unused Code introduced by
The parameter $table is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
441
        $newFields = null,
0 ignored issues
show
Unused Code introduced by
The parameter $newFields is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
442
        $newIndexes = null,
0 ignored issues
show
Unused Code introduced by
The parameter $newIndexes is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
443
        $alteredFields = null,
0 ignored issues
show
Unused Code introduced by
The parameter $alteredFields is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
444
        $alteredIndexes = null,
0 ignored issues
show
Unused Code introduced by
The parameter $alteredIndexes is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
445
        $alteredOptions = null,
0 ignored issues
show
Unused Code introduced by
The parameter $alteredOptions is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
446
        $advancedOptions = null
0 ignored issues
show
Unused Code introduced by
The parameter $advancedOptions is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
447
    ) {
448
        return call_user_func_array(
449
            array($this->realConn, __FUNCTION__),
450
            func_get_args()
451
        );
452
    }
453
454 View Code Duplication
    public function comparisonClause(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
455
        $field,
456
        $value,
457
        $exact = false,
458
        $negate = false,
459
        $caseSensitive = false,
460
        $parameterised = false
461
    ) {
462
        return call_user_func_array(
463
            array($this->realConn, __FUNCTION__),
464
            func_get_args()
465
        );
466
    }
467
468
    public function createDatabase()
469
    {
470
        return call_user_func_array(
471
            array($this->realConn, __FUNCTION__),
472
            func_get_args()
473
        );
474
    }
475
476
    public function createField($table, $field, $spec)
0 ignored issues
show
Unused Code introduced by
The parameter $table is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $field is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $spec is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
477
    {
478
        return call_user_func_array(
479
            array($this->realConn, __FUNCTION__),
480
            func_get_args()
481
        );
482
    }
483
484 View Code Duplication
    public function createTable(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
485
        $table,
0 ignored issues
show
Unused Code introduced by
The parameter $table is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
486
        $fields = null,
0 ignored issues
show
Unused Code introduced by
The parameter $fields is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
487
        $indexes = null,
0 ignored issues
show
Unused Code introduced by
The parameter $indexes is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
488
        $options = null,
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
489
        $advancedOptions = null
0 ignored issues
show
Unused Code introduced by
The parameter $advancedOptions is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
490
    ) {
491
        return call_user_func_array(
492
            array($this->realConn, __FUNCTION__),
493
            func_get_args()
494
        );
495
    }
496
497
    public function datetimeDifferenceClause($date1, $date2)
498
    {
499
        return call_user_func_array(
500
            array($this->realConn, __FUNCTION__),
501
            func_get_args()
502
        );
503
    }
504
505
    public function datetimeIntervalClause($date, $interval)
506
    {
507
        return call_user_func_array(
508
            array($this->realConn, __FUNCTION__),
509
            func_get_args()
510
        );
511
    }
512
513
    public function enumValuesForField($tableName, $fieldName)
0 ignored issues
show
Unused Code introduced by
The parameter $tableName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $fieldName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
514
    {
515
        return call_user_func_array(
516
            array($this->realConn, __FUNCTION__),
517
            func_get_args()
518
        );
519
    }
520
521
    public function fieldList($table)
0 ignored issues
show
Unused Code introduced by
The parameter $table is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
522
    {
523
        return call_user_func_array(
524
            array($this->realConn, __FUNCTION__),
525
            func_get_args()
526
        );
527
    }
528
529
    public function formattedDatetimeClause($date, $format)
530
    {
531
        return call_user_func_array(
532
            array($this->realConn, __FUNCTION__),
533
            func_get_args()
534
        );
535
    }
536
537
    public function getConnect($parameters)
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
538
    {
539
        return call_user_func_array(
540
            array($this->realConn, __FUNCTION__),
541
            func_get_args()
542
        );
543
    }
544
545
    public function getGeneratedID($table)
546
    {
547
        return call_user_func_array(
548
            array($this->realConn, __FUNCTION__),
549
            func_get_args()
550
        );
551
    }
552
553
    public function hasTable($tableName)
0 ignored issues
show
Unused Code introduced by
The parameter $tableName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
554
    {
555
        return call_user_func_array(
556
            array($this->realConn, __FUNCTION__),
557
            func_get_args()
558
        );
559
    }
560
561
    public function isActive()
562
    {
563
        return call_user_func_array(
564
            array($this->realConn, __FUNCTION__),
565
            func_get_args()
566
        );
567
    }
568
569
    public function renameField($tableName, $oldName, $newName)
0 ignored issues
show
Unused Code introduced by
The parameter $tableName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $oldName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $newName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
570
    {
571
        return call_user_func_array(
572
            array($this->realConn, __FUNCTION__),
573
            func_get_args()
574
        );
575
    }
576
577
    public function renameTable($oldTableName, $newTableName)
0 ignored issues
show
Unused Code introduced by
The parameter $oldTableName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $newTableName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
578
    {
579
        return call_user_func_array(
580
            array($this->realConn, __FUNCTION__),
581
            func_get_args()
582
        );
583
    }
584
585
    public function supportsTimezoneOverride()
586
    {
587
        return call_user_func_array(
588
            array($this->realConn, __FUNCTION__),
589
            func_get_args()
590
        );
591
    }
592
593
    public function supportsTransactions()
594
    {
595
        return call_user_func_array(
596
            array($this->realConn, __FUNCTION__),
597
            func_get_args()
598
        );
599
    }
600
601
    public function tableList()
602
    {
603
        return call_user_func_array(
604
            array($this->realConn, __FUNCTION__),
605
            func_get_args()
606
        );
607
    }
608
609
    public function transactionEnd($chain = false)
610
    {
611
        return call_user_func_array(
612
            array($this->realConn, __FUNCTION__),
613
            func_get_args()
614
        );
615
    }
616
617
    public function transactionRollback($savepoint = false)
618
    {
619
        return call_user_func_array(
620
            array($this->realConn, __FUNCTION__),
621
            func_get_args()
622
        );
623
    }
624
625
    public function transactionSavepoint($savepoint)
626
    {
627
        return call_user_func_array(
628
            array($this->realConn, __FUNCTION__),
629
            func_get_args()
630
        );
631
    }
632
633
    public function transactionStart($transaction_mode = false, $session_characteristics = false)
634
    {
635
        return call_user_func_array(
636
            array($this->realConn, __FUNCTION__),
637
            func_get_args()
638
        );
639
    }
640
641
    public function clearTable($table)
642
    {
643
        return call_user_func_array(
644
            array($this->realConn, __FUNCTION__),
645
            func_get_args()
646
        );
647
    }
648
649
    public function getDatabaseServer()
650
    {
651
        return call_user_func_array(
652
            array($this->realConn, __FUNCTION__),
653
            func_get_args()
654
        );
655
    }
656
657
    public function now()
658
    {
659
        return call_user_func_array(
660
            array($this->realConn, __FUNCTION__),
661
            func_get_args()
662
        );
663
    }
664
665
    public function random()
666
    {
667
        return call_user_func_array(
668
            array($this->realConn, __FUNCTION__),
669
            func_get_args()
670
        );
671
    }
672
673
    public function searchEngine(
674
        $classesToSearch,
675
        $keywords,
676
        $start,
677
        $pageLength,
678
        $sortBy = "Relevance DESC",
679
        $extraFilter = "",
680
        $booleanSearch = false,
681
        $alternativeFileFilter = "",
682
        $invertedMatch = false
683
    ) {
684
        return call_user_func_array(
685
            array($this->realConn, __FUNCTION__),
686
            func_get_args()
687
        );
688
    }
689
690
    public function supportsCollations()
691
    {
692
        return call_user_func_array(
693
            array($this->realConn, __FUNCTION__),
694
            func_get_args()
695
        );
696
    }
697
}
698