1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Fake database driver for testing purposes |
4
|
|
|
* |
5
|
|
|
* It has hardcoded results for given queries what makes easy to use it |
6
|
|
|
* in testsuite. Feel free to include other queries which your test will |
7
|
|
|
* need. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
declare(strict_types=1); |
11
|
|
|
|
12
|
|
|
namespace PhpMyAdmin\Tests\Stubs; |
13
|
|
|
|
14
|
|
|
use PhpMyAdmin\Dbal\DatabaseName; |
15
|
|
|
use PhpMyAdmin\Dbal\DbiExtension; |
16
|
|
|
use PhpMyAdmin\Dbal\ResultInterface; |
17
|
|
|
use PhpMyAdmin\FieldMetadata; |
18
|
|
|
use PHPUnit\Framework\Assert; |
19
|
|
|
|
20
|
|
|
use function addslashes; |
21
|
|
|
use function count; |
22
|
|
|
use function is_array; |
23
|
|
|
use function is_bool; |
24
|
|
|
use function is_int; |
25
|
|
|
use function preg_replace; |
26
|
|
|
use function str_replace; |
27
|
|
|
use function trim; |
28
|
|
|
|
29
|
|
|
use const MYSQLI_TYPE_BLOB; |
30
|
|
|
use const MYSQLI_TYPE_DATETIME; |
31
|
|
|
use const MYSQLI_TYPE_DECIMAL; |
32
|
|
|
use const MYSQLI_TYPE_STRING; |
33
|
|
|
|
34
|
|
|
// phpcs:disable Generic.Files.LineLength.TooLong |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Fake database driver for testing purposes |
38
|
|
|
* |
39
|
|
|
* It has hardcoded results for given queries what makes easy to use it |
40
|
|
|
* in testsuite. Feel free to include other queries which your test will |
41
|
|
|
* need. |
42
|
|
|
*/ |
43
|
|
|
class DbiDummy implements DbiExtension |
44
|
|
|
{ |
45
|
|
|
/** |
46
|
|
|
* First in, last out queries |
47
|
|
|
* |
48
|
|
|
* The results will be distributed in the filo way |
49
|
|
|
* |
50
|
|
|
* @var array |
51
|
|
|
* @phpstan-var array{ |
52
|
|
|
* 'query': string, |
53
|
|
|
* 'result': ((int[]|string[]|array{string: string})[])|bool|bool[]|empty-array, |
54
|
|
|
* 'columns'?: string[], |
55
|
|
|
* 'metadata'?: object[]|empty-array, |
56
|
|
|
* 'used'?: bool, |
57
|
|
|
* 'pos'?: int |
58
|
|
|
* }[] |
59
|
|
|
*/ |
60
|
|
|
private $filoQueries = []; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* First in, last out queries |
64
|
|
|
* |
65
|
|
|
* The results will be distributed in the fifo way |
66
|
|
|
* |
67
|
|
|
* @var string[] |
68
|
|
|
*/ |
69
|
|
|
private $fifoDatabasesToSelect = []; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var array |
73
|
|
|
* @phpstan-var array{ |
74
|
|
|
* 'query': string, |
75
|
|
|
* 'result': ((int[]|string[]|array{string: string})[])|bool|bool[]|empty-array, |
76
|
|
|
* 'columns'?: string[], |
77
|
|
|
* 'metadata'?: object[]|empty-array, |
78
|
|
|
* 'pos'?: int |
79
|
|
|
* }[] |
80
|
|
|
*/ |
81
|
|
|
private $dummyQueries = []; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @var string[] |
85
|
|
|
* @psalm-var non-empty-string[] |
86
|
|
|
*/ |
87
|
|
|
private $fifoErrorCodes = []; |
88
|
|
|
|
89
|
|
|
public const OFFSET_GLOBAL = 1000; |
90
|
|
|
|
91
|
|
|
public function __construct() |
92
|
|
|
{ |
93
|
|
|
$this->init(); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* connects to the database server |
98
|
|
|
* |
99
|
|
|
* @param string $user mysql user name |
100
|
|
|
* @param string $password mysql user password |
101
|
|
|
* @param array $server host/port/socket/persistent |
102
|
|
|
* |
103
|
|
|
* @return mixed false on error or a mysqli object on success |
104
|
|
|
*/ |
105
|
|
|
public function connect( |
106
|
|
|
$user, |
107
|
|
|
$password, |
108
|
|
|
array $server = [] |
109
|
|
|
) { |
110
|
|
|
return true; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* selects given database |
115
|
|
|
* |
116
|
|
|
* @param string|DatabaseName $databaseName name of db to select |
117
|
|
|
* @param object $link mysql link resource |
118
|
|
|
*/ |
119
|
|
|
public function selectDb($databaseName, $link): bool |
120
|
|
|
{ |
121
|
|
|
$databaseName = $databaseName instanceof DatabaseName |
122
|
|
|
? $databaseName->getName() : $databaseName; |
123
|
|
|
|
124
|
|
|
foreach ($this->fifoDatabasesToSelect as $key => $databaseNameItem) { |
125
|
|
|
if ($databaseNameItem !== $databaseName) { |
126
|
|
|
continue; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
// It was used |
130
|
|
|
unset($this->fifoDatabasesToSelect[$key]); |
131
|
|
|
|
132
|
|
|
return true; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
Assert::markTestIncomplete('Non expected select of database: ' . $databaseName); |
|
|
|
|
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
public function hasUnUsedErrors(): bool |
139
|
|
|
{ |
140
|
|
|
return $this->fifoErrorCodes !== []; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @return string[] |
145
|
|
|
*/ |
146
|
|
|
public function getUnUsedDatabaseSelects(): array |
147
|
|
|
{ |
148
|
|
|
return $this->fifoDatabasesToSelect; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @return array[] |
153
|
|
|
*/ |
154
|
|
|
public function getUnUsedQueries(): array |
155
|
|
|
{ |
156
|
|
|
$unUsed = []; |
157
|
|
|
foreach ($this->filoQueries as $query) { |
158
|
|
|
if (($query['used'] ?? false) === true) { |
159
|
|
|
continue; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
$unUsed[] = $query; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
return $unUsed; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
public function assertAllQueriesConsumed(): void |
169
|
|
|
{ |
170
|
|
|
Assert::assertSame([], $this->getUnUsedQueries(), 'Some queries where not used!'); |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @return false|int|null |
175
|
|
|
*/ |
176
|
|
|
private function findFiloQuery(string $query) |
177
|
|
|
{ |
178
|
|
|
for ($i = 0, $nb = count($this->filoQueries); $i < $nb; $i++) { |
179
|
|
|
if ($this->filoQueries[$i]['query'] !== $query) { |
180
|
|
|
continue; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
if ($this->filoQueries[$i]['used'] ?? false) { |
184
|
|
|
continue;// Is has already been used |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
$this->filoQueries[$i]['pos'] = 0; |
188
|
|
|
$this->filoQueries[$i]['used'] = true; |
189
|
|
|
|
190
|
|
|
if (! is_array($this->filoQueries[$i]['result'])) { |
191
|
|
|
return false; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
return $i; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
return null; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* runs a query and returns the result |
202
|
|
|
* |
203
|
|
|
* @param string $query query to run |
204
|
|
|
* @param object $link mysql link resource |
205
|
|
|
* @param int $options query options |
206
|
|
|
* |
207
|
|
|
* @return DummyResult|false |
208
|
|
|
*/ |
209
|
|
|
public function realQuery(string $query, $link, int $options) |
210
|
|
|
{ |
211
|
|
|
$query = trim((string) preg_replace('/ */', ' ', str_replace("\n", ' ', $query))); |
212
|
|
|
$filoQuery = $this->findFiloQuery($query); |
213
|
|
|
if ($filoQuery === false) { |
214
|
|
|
return false; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
if ($filoQuery !== null) {// Found a matching query |
|
|
|
|
218
|
|
|
return new DummyResult($this, $filoQuery); |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
for ($i = 0, $nb = count($this->dummyQueries); $i < $nb; $i++) { |
222
|
|
|
if ($this->dummyQueries[$i]['query'] !== $query) { |
223
|
|
|
continue; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
$this->dummyQueries[$i]['pos'] = 0; |
227
|
|
|
if (! is_array($this->dummyQueries[$i]['result'])) { |
228
|
|
|
return false; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
return new DummyResult($this, $i + self::OFFSET_GLOBAL); |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
Assert::markTestIncomplete('Not supported query: ' . $query); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* Run the multi query and output the results |
239
|
|
|
* |
240
|
|
|
* @param object $link connection object |
241
|
|
|
* @param string $query multi query statement to execute |
242
|
|
|
* |
243
|
|
|
* @return bool |
244
|
|
|
*/ |
245
|
|
|
public function realMultiQuery($link, $query) |
246
|
|
|
{ |
247
|
|
|
return false; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* returns result data from $result |
252
|
|
|
* |
253
|
|
|
* @param int $result MySQL result |
254
|
|
|
*/ |
255
|
|
|
public function fetchAny($result): ?array |
256
|
|
|
{ |
257
|
|
|
$query_data = &$this->getQueryData($result); |
258
|
|
|
if ($query_data['pos'] >= count((array) $query_data['result'])) { |
259
|
|
|
return null; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
$ret = $query_data['result'][$query_data['pos']]; |
263
|
|
|
$query_data['pos'] += 1; |
264
|
|
|
|
265
|
|
|
return $ret; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* returns array of rows with associative keys from $result |
270
|
|
|
* |
271
|
|
|
* @param int $result MySQL result |
272
|
|
|
*/ |
273
|
|
|
public function fetchAssoc($result): ?array |
274
|
|
|
{ |
275
|
|
|
$data = $this->fetchAny($result); |
276
|
|
|
$query_data = $this->getQueryData($result); |
277
|
|
|
if (! is_array($data) || ! isset($query_data['columns'])) { |
278
|
|
|
return $data; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
$ret = []; |
282
|
|
|
foreach ($data as $key => $val) { |
283
|
|
|
$ret[$query_data['columns'][$key]] = $val; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
return $ret; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* returns array of rows with numeric keys from $result |
291
|
|
|
* |
292
|
|
|
* @param int $result MySQL result |
293
|
|
|
*/ |
294
|
|
|
public function fetchRow($result): ?array |
295
|
|
|
{ |
296
|
|
|
return $this->fetchAny($result); |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* Adjusts the result pointer to an arbitrary row in the result |
301
|
|
|
* |
302
|
|
|
* @param int $result database result |
303
|
|
|
* @param int $offset offset to seek |
304
|
|
|
*/ |
305
|
|
|
public function dataSeek($result, $offset): bool |
306
|
|
|
{ |
307
|
|
|
$query_data = &$this->getQueryData($result); |
308
|
|
|
if ($offset > count($query_data['result'])) { |
309
|
|
|
return false; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
$query_data['pos'] = $offset; |
313
|
|
|
|
314
|
|
|
return true; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* Check if there are any more query results from a multi query |
319
|
|
|
* |
320
|
|
|
* @param object $link the connection object |
321
|
|
|
*/ |
322
|
|
|
public function moreResults($link): bool |
323
|
|
|
{ |
324
|
|
|
return false; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* Prepare next result from multi_query |
329
|
|
|
* |
330
|
|
|
* @param object $link the connection object |
331
|
|
|
*/ |
332
|
|
|
public function nextResult($link): bool |
333
|
|
|
{ |
334
|
|
|
return false; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* Store the result returned from multi query |
339
|
|
|
* |
340
|
|
|
* @param object $link the connection object |
341
|
|
|
* |
342
|
|
|
* @return ResultInterface|false false when empty results / result set when not empty |
343
|
|
|
*/ |
344
|
|
|
public function storeResult($link) |
345
|
|
|
{ |
346
|
|
|
return false; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* Returns a string representing the type of connection used |
351
|
|
|
* |
352
|
|
|
* @param object $link mysql link |
353
|
|
|
* |
354
|
|
|
* @return string type of connection used |
355
|
|
|
*/ |
356
|
|
|
public function getHostInfo($link) |
357
|
|
|
{ |
358
|
|
|
return ''; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* Returns the version of the MySQL protocol used |
363
|
|
|
* |
364
|
|
|
* @param object $link mysql link |
365
|
|
|
* |
366
|
|
|
* @return int version of the MySQL protocol used |
367
|
|
|
*/ |
368
|
|
|
public function getProtoInfo($link) |
369
|
|
|
{ |
370
|
|
|
return -1; |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
/** |
374
|
|
|
* returns a string that represents the client library version |
375
|
|
|
* |
376
|
|
|
* @return string MySQL client library version |
377
|
|
|
*/ |
378
|
|
|
public function getClientInfo() |
379
|
|
|
{ |
380
|
|
|
return 'libmysql - mysqlnd x.x.x-dev (phpMyAdmin tests)'; |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
/** |
384
|
|
|
* Returns last error message or an empty string if no errors occurred. |
385
|
|
|
* |
386
|
|
|
* @param object $link connection link |
387
|
|
|
*/ |
388
|
|
|
public function getError($link): string |
389
|
|
|
{ |
390
|
|
|
foreach ($this->fifoErrorCodes as $i => $code) { |
391
|
|
|
unset($this->fifoErrorCodes[$i]); |
392
|
|
|
|
393
|
|
|
return $code; |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
return ''; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* returns the number of rows returned by last query |
401
|
|
|
* |
402
|
|
|
* @param int|bool $result MySQL result |
403
|
|
|
* |
404
|
|
|
* @return string|int |
405
|
|
|
* @psalm-return int|numeric-string |
406
|
|
|
*/ |
407
|
|
|
public function numRows($result) |
408
|
|
|
{ |
409
|
|
|
if (is_bool($result)) { |
410
|
|
|
return 0; |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
$query_data = $this->getQueryData($result); |
414
|
|
|
|
415
|
|
|
return count($query_data['result']); |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* returns the number of rows affected by last query |
420
|
|
|
* |
421
|
|
|
* @param object $link the mysql object |
422
|
|
|
* @param bool $get_from_cache whether to retrieve from cache |
423
|
|
|
* |
424
|
|
|
* @return int|string |
425
|
|
|
* @psalm-return int|numeric-string |
426
|
|
|
*/ |
427
|
|
|
public function affectedRows($link = null, $get_from_cache = true) |
428
|
|
|
{ |
429
|
|
|
return $GLOBALS['cached_affected_rows'] ?? 0; |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* returns metainfo for fields in $result |
434
|
|
|
* |
435
|
|
|
* @param int $result result set identifier |
436
|
|
|
* |
437
|
|
|
* @return FieldMetadata[] meta info for fields in $result |
438
|
|
|
*/ |
439
|
|
|
public function getFieldsMeta($result): array |
440
|
|
|
{ |
441
|
|
|
$query_data = $this->getQueryData($result); |
442
|
|
|
/** @var FieldMetadata[] $metadata */ |
443
|
|
|
$metadata = $query_data['metadata'] ?? []; |
444
|
|
|
|
445
|
|
|
if (isset($query_data['columns'])) { |
446
|
|
|
/** @var string[] $columns */ |
447
|
|
|
$columns = $query_data['columns']; |
448
|
|
|
foreach ($columns as $i => $column) { |
449
|
|
|
if (isset($metadata[$i])) { |
450
|
|
|
$metadata[$i]->name = $column; |
451
|
|
|
} else { |
452
|
|
|
$metadata[$i] = new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) ['name' => $column]); |
453
|
|
|
} |
454
|
|
|
} |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
return $metadata; |
458
|
|
|
} |
459
|
|
|
|
460
|
|
|
/** |
461
|
|
|
* return number of fields in given $result |
462
|
|
|
* |
463
|
|
|
* @param int $result MySQL result |
464
|
|
|
* |
465
|
|
|
* @return int field count |
466
|
|
|
*/ |
467
|
|
|
public function numFields($result) |
468
|
|
|
{ |
469
|
|
|
$query_data = $this->getQueryData($result); |
470
|
|
|
|
471
|
|
|
return count($query_data['columns'] ?? []); |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
/** |
475
|
|
|
* returns properly escaped string for use in MySQL queries |
476
|
|
|
* |
477
|
|
|
* @param mixed $link database link |
478
|
|
|
* @param string $string string to be escaped |
479
|
|
|
* |
480
|
|
|
* @return string a MySQL escaped string |
481
|
|
|
*/ |
482
|
|
|
public function escapeString($link, $string) |
483
|
|
|
{ |
484
|
|
|
return addslashes($string); |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
public function addSelectDb(string $databaseName): void |
488
|
|
|
{ |
489
|
|
|
$this->fifoDatabasesToSelect[] = $databaseName; |
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
/** |
493
|
|
|
* Adds query result for testing |
494
|
|
|
* |
495
|
|
|
* @param string $query SQL |
496
|
|
|
* @param array|bool $result Expected result |
497
|
|
|
* @param string[] $columns The result columns |
498
|
|
|
* @param object[] $metadata The result metadata |
499
|
|
|
* @phpstan-param array<int, array<int, array{string: string}|bool|int|string|null>|bool>|bool $result |
500
|
|
|
*/ |
501
|
|
|
public function addResult(string $query, $result, array $columns = [], array $metadata = []): void |
502
|
|
|
{ |
503
|
|
|
$this->filoQueries[] = [ |
504
|
|
|
'query' => $query, |
505
|
|
|
'result' => $result, |
506
|
|
|
'columns' => $columns, |
507
|
|
|
'metadata' => $metadata, |
508
|
|
|
]; |
509
|
|
|
} |
510
|
|
|
|
511
|
|
|
/** |
512
|
|
|
* Adds an error or null as no error to the stack |
513
|
|
|
* |
514
|
|
|
* @psalm-param non-empty-string $code |
515
|
|
|
*/ |
516
|
|
|
public function addErrorCode(string $code): void |
517
|
|
|
{ |
518
|
|
|
$this->fifoErrorCodes[] = $code; |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
public function removeDefaultResults(): void |
522
|
|
|
{ |
523
|
|
|
$this->dummyQueries = []; |
524
|
|
|
} |
525
|
|
|
|
526
|
|
|
/** |
527
|
|
|
* @param mixed $link link |
528
|
|
|
* @param string $query query |
529
|
|
|
* |
530
|
|
|
* @return object|false |
531
|
|
|
*/ |
532
|
|
|
public function prepare($link, string $query) |
533
|
|
|
{ |
534
|
|
|
return false; |
535
|
|
|
} |
536
|
|
|
|
537
|
|
|
/** |
538
|
|
|
* Return query data for ID |
539
|
|
|
* |
540
|
|
|
* @param object|int $result result set identifier |
541
|
|
|
* |
542
|
|
|
* @return array |
543
|
|
|
*/ |
544
|
|
|
private function &getQueryData($result): array |
545
|
|
|
{ |
546
|
|
|
if (! is_int($result)) { |
547
|
|
|
// This never happens |
548
|
|
|
return []; |
549
|
|
|
} |
550
|
|
|
|
551
|
|
|
if ($result >= self::OFFSET_GLOBAL) { |
552
|
|
|
return $this->dummyQueries[$result - self::OFFSET_GLOBAL]; |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
return $this->filoQueries[$result]; |
556
|
|
|
} |
557
|
|
|
|
558
|
|
|
public function assertAllSelectsConsumed(): void |
559
|
|
|
{ |
560
|
|
|
Assert::assertSame([], $this->getUnUsedDatabaseSelects(), 'Some database selects where not used!'); |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
public function assertAllErrorCodesConsumed(): void |
564
|
|
|
{ |
565
|
|
|
Assert::assertFalse($this->hasUnUsedErrors(), 'Some error codes where not used!'); |
566
|
|
|
} |
567
|
|
|
|
568
|
|
|
private function init(): void |
569
|
|
|
{ |
570
|
|
|
/** |
571
|
|
|
* Array of queries this "driver" supports |
572
|
|
|
*/ |
573
|
|
|
$this->dummyQueries = [ |
574
|
|
|
[ |
575
|
|
|
'query' => 'SELECT 1', |
576
|
|
|
'result' => [['1']], |
577
|
|
|
], |
578
|
|
|
[ |
579
|
|
|
'query' => 'SELECT CURRENT_USER();', |
580
|
|
|
'result' => [['pma_test@localhost']], |
581
|
|
|
], |
582
|
|
|
[ |
583
|
|
|
'query' => "SHOW VARIABLES LIKE 'lower_case_table_names'", |
584
|
|
|
'result' => [ |
585
|
|
|
[ |
586
|
|
|
'lower_case_table_names', |
587
|
|
|
'1', |
588
|
|
|
], |
589
|
|
|
], |
590
|
|
|
], |
591
|
|
|
[ |
592
|
|
|
'query' => 'SELECT 1 FROM mysql.user LIMIT 1', |
593
|
|
|
'result' => [['1']], |
594
|
|
|
], |
595
|
|
|
[ |
596
|
|
|
'query' => 'SELECT 1 FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES`' |
597
|
|
|
. " WHERE `PRIVILEGE_TYPE` = 'CREATE USER'" |
598
|
|
|
. " AND '''pma_test''@''localhost''' LIKE `GRANTEE` LIMIT 1", |
599
|
|
|
'result' => [['1']], |
600
|
|
|
], |
601
|
|
|
[ |
602
|
|
|
'query' => 'SELECT 1 FROM (SELECT `GRANTEE`, `IS_GRANTABLE`' |
603
|
|
|
. ' FROM `INFORMATION_SCHEMA`.`COLUMN_PRIVILEGES`' |
604
|
|
|
. ' UNION SELECT `GRANTEE`, `IS_GRANTABLE`' |
605
|
|
|
. ' FROM `INFORMATION_SCHEMA`.`TABLE_PRIVILEGES`' |
606
|
|
|
. ' UNION SELECT `GRANTEE`, `IS_GRANTABLE`' |
607
|
|
|
. ' FROM `INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES`' |
608
|
|
|
. ' UNION SELECT `GRANTEE`, `IS_GRANTABLE`' |
609
|
|
|
. ' FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES`) t' |
610
|
|
|
. " WHERE `IS_GRANTABLE` = 'YES'" |
611
|
|
|
. " AND '''pma_test''@''localhost''' LIKE `GRANTEE` LIMIT 1", |
612
|
|
|
'result' => [['1']], |
613
|
|
|
], |
614
|
|
|
[ |
615
|
|
|
'query' => 'SHOW MASTER LOGS', |
616
|
|
|
'result' => [ |
617
|
|
|
[ |
618
|
|
|
'Log_name' => 'index1', |
619
|
|
|
'File_size' => 100, |
620
|
|
|
], |
621
|
|
|
[ |
622
|
|
|
'Log_name' => 'index2', |
623
|
|
|
'File_size' => 200, |
624
|
|
|
], |
625
|
|
|
], |
626
|
|
|
], |
627
|
|
|
[ |
628
|
|
|
'query' => 'SHOW STORAGE ENGINES', |
629
|
|
|
'result' => [ |
630
|
|
|
[ |
631
|
|
|
'Engine' => 'dummy', |
632
|
|
|
'Support' => 'YES', |
633
|
|
|
'Comment' => 'dummy comment', |
634
|
|
|
], |
635
|
|
|
[ |
636
|
|
|
'Engine' => 'dummy2', |
637
|
|
|
'Support' => 'NO', |
638
|
|
|
'Comment' => 'dummy2 comment', |
639
|
|
|
], |
640
|
|
|
[ |
641
|
|
|
'Engine' => 'FEDERATED', |
642
|
|
|
'Support' => 'NO', |
643
|
|
|
'Comment' => 'Federated MySQL storage engine', |
644
|
|
|
], |
645
|
|
|
[ |
646
|
|
|
'Engine' => 'Pbxt', |
647
|
|
|
'Support' => 'NO', |
648
|
|
|
'Comment' => 'Pbxt storage engine', |
649
|
|
|
], |
650
|
|
|
], |
651
|
|
|
], |
652
|
|
|
[ |
653
|
|
|
'query' => 'SHOW STATUS WHERE Variable_name' |
654
|
|
|
. ' LIKE \'Innodb\\_buffer\\_pool\\_%\'' |
655
|
|
|
. ' OR Variable_name = \'Innodb_page_size\';', |
656
|
|
|
'result' => [ |
657
|
|
|
[ |
658
|
|
|
'Innodb_buffer_pool_pages_data', |
659
|
|
|
0, |
660
|
|
|
], |
661
|
|
|
[ |
662
|
|
|
'Innodb_buffer_pool_pages_dirty', |
663
|
|
|
0, |
664
|
|
|
], |
665
|
|
|
[ |
666
|
|
|
'Innodb_buffer_pool_pages_flushed', |
667
|
|
|
0, |
668
|
|
|
], |
669
|
|
|
[ |
670
|
|
|
'Innodb_buffer_pool_pages_free', |
671
|
|
|
0, |
672
|
|
|
], |
673
|
|
|
[ |
674
|
|
|
'Innodb_buffer_pool_pages_misc', |
675
|
|
|
0, |
676
|
|
|
], |
677
|
|
|
[ |
678
|
|
|
'Innodb_buffer_pool_pages_total', |
679
|
|
|
4096, |
680
|
|
|
], |
681
|
|
|
[ |
682
|
|
|
'Innodb_buffer_pool_read_ahead_rnd', |
683
|
|
|
0, |
684
|
|
|
], |
685
|
|
|
[ |
686
|
|
|
'Innodb_buffer_pool_read_ahead', |
687
|
|
|
0, |
688
|
|
|
], |
689
|
|
|
[ |
690
|
|
|
'Innodb_buffer_pool_read_ahead_evicted', |
691
|
|
|
0, |
692
|
|
|
], |
693
|
|
|
[ |
694
|
|
|
'Innodb_buffer_pool_read_requests', |
695
|
|
|
64, |
696
|
|
|
], |
697
|
|
|
[ |
698
|
|
|
'Innodb_buffer_pool_reads', |
699
|
|
|
32, |
700
|
|
|
], |
701
|
|
|
[ |
702
|
|
|
'Innodb_buffer_pool_wait_free', |
703
|
|
|
0, |
704
|
|
|
], |
705
|
|
|
[ |
706
|
|
|
'Innodb_buffer_pool_write_requests', |
707
|
|
|
64, |
708
|
|
|
], |
709
|
|
|
[ |
710
|
|
|
'Innodb_page_size', |
711
|
|
|
16384, |
712
|
|
|
], |
713
|
|
|
], |
714
|
|
|
], |
715
|
|
|
[ |
716
|
|
|
'query' => 'SHOW ENGINE INNODB STATUS;', |
717
|
|
|
'result' => false, |
718
|
|
|
], |
719
|
|
|
[ |
720
|
|
|
'query' => 'SELECT @@innodb_version;', |
721
|
|
|
'result' => [ |
722
|
|
|
['1.1.8'], |
723
|
|
|
], |
724
|
|
|
], |
725
|
|
|
[ |
726
|
|
|
'query' => 'SELECT @@disabled_storage_engines', |
727
|
|
|
'result' => [ |
728
|
|
|
[''], |
729
|
|
|
], |
730
|
|
|
], |
731
|
|
|
[ |
732
|
|
|
'query' => 'SHOW GLOBAL VARIABLES ;', |
733
|
|
|
'result' => [], |
734
|
|
|
], |
735
|
|
|
[ |
736
|
|
|
'query' => 'SHOW GLOBAL VARIABLES LIKE \'innodb_file_per_table\';', |
737
|
|
|
'result' => [ |
738
|
|
|
[ |
739
|
|
|
'innodb_file_per_table', |
740
|
|
|
'OFF', |
741
|
|
|
], |
742
|
|
|
], |
743
|
|
|
], |
744
|
|
|
[ |
745
|
|
|
'query' => 'SHOW GLOBAL VARIABLES LIKE \'innodb_file_format\';', |
746
|
|
|
'result' => [ |
747
|
|
|
[ |
748
|
|
|
'innodb_file_format', |
749
|
|
|
'Antelope', |
750
|
|
|
], |
751
|
|
|
], |
752
|
|
|
], |
753
|
|
|
[ |
754
|
|
|
'query' => 'SELECT @@collation_server', |
755
|
|
|
'result' => [ |
756
|
|
|
['utf8_general_ci'], |
757
|
|
|
], |
758
|
|
|
], |
759
|
|
|
[ |
760
|
|
|
'query' => 'SELECT @@lc_messages;', |
761
|
|
|
'result' => [], |
762
|
|
|
], |
763
|
|
|
[ |
764
|
|
|
'query' => 'SHOW SESSION VARIABLES LIKE \'FOREIGN_KEY_CHECKS\';', |
765
|
|
|
'result' => [ |
766
|
|
|
[ |
767
|
|
|
'foreign_key_checks', |
768
|
|
|
'ON', |
769
|
|
|
], |
770
|
|
|
], |
771
|
|
|
], |
772
|
|
|
[ |
773
|
|
|
'query' => 'SHOW TABLES FROM `pma_test`;', |
774
|
|
|
'result' => [ |
775
|
|
|
['table1'], |
776
|
|
|
['table2'], |
777
|
|
|
], |
778
|
|
|
], |
779
|
|
|
[ |
780
|
|
|
'query' => 'SHOW TABLES FROM `pmadb`', |
781
|
|
|
'result' => [ |
782
|
|
|
['column_info'], |
783
|
|
|
], |
784
|
|
|
], |
785
|
|
|
[ |
786
|
|
|
'query' => 'SHOW COLUMNS FROM `pma_test`.`table1`', |
787
|
|
|
'columns' => [ |
788
|
|
|
'Field', |
789
|
|
|
'Type', |
790
|
|
|
'Null', |
791
|
|
|
'Key', |
792
|
|
|
'Default', |
793
|
|
|
'Extra', |
794
|
|
|
], |
795
|
|
|
'result' => [ |
796
|
|
|
[ |
797
|
|
|
'i', |
798
|
|
|
'int(11)', |
799
|
|
|
'NO', |
800
|
|
|
'PRI', |
801
|
|
|
'NULL', |
802
|
|
|
'auto_increment', |
803
|
|
|
], |
804
|
|
|
[ |
805
|
|
|
'o', |
806
|
|
|
'int(11)', |
807
|
|
|
'NO', |
808
|
|
|
'MUL', |
809
|
|
|
'NULL', |
810
|
|
|
'', |
811
|
|
|
], |
812
|
|
|
], |
813
|
|
|
], |
814
|
|
|
[ |
815
|
|
|
'query' => 'SHOW INDEXES FROM `pma_test`.`table1` WHERE (Non_unique = 0)', |
816
|
|
|
'result' => [], |
817
|
|
|
], |
818
|
|
|
[ |
819
|
|
|
'query' => 'SHOW COLUMNS FROM `pma_test`.`table2`', |
820
|
|
|
'columns' => [ |
821
|
|
|
'Field', |
822
|
|
|
'Type', |
823
|
|
|
'Null', |
824
|
|
|
'Key', |
825
|
|
|
'Default', |
826
|
|
|
'Extra', |
827
|
|
|
], |
828
|
|
|
'result' => [ |
829
|
|
|
[ |
830
|
|
|
'i', |
831
|
|
|
'int(11)', |
832
|
|
|
'NO', |
833
|
|
|
'PRI', |
834
|
|
|
'NULL', |
835
|
|
|
'auto_increment', |
836
|
|
|
], |
837
|
|
|
[ |
838
|
|
|
'o', |
839
|
|
|
'int(11)', |
840
|
|
|
'NO', |
841
|
|
|
'MUL', |
842
|
|
|
'NULL', |
843
|
|
|
'', |
844
|
|
|
], |
845
|
|
|
], |
846
|
|
|
], |
847
|
|
|
[ |
848
|
|
|
'query' => 'SHOW INDEXES FROM `pma_test`.`table1`', |
849
|
|
|
'result' => [], |
850
|
|
|
], |
851
|
|
|
[ |
852
|
|
|
'query' => 'SHOW INDEXES FROM `pma_test`.`table2`', |
853
|
|
|
'result' => [], |
854
|
|
|
], |
855
|
|
|
[ |
856
|
|
|
'query' => 'SHOW COLUMNS FROM `pma`.`table1`', |
857
|
|
|
'columns' => [ |
858
|
|
|
'Field', |
859
|
|
|
'Type', |
860
|
|
|
'Null', |
861
|
|
|
'Key', |
862
|
|
|
'Default', |
863
|
|
|
'Extra', |
864
|
|
|
'Privileges', |
865
|
|
|
'Comment', |
866
|
|
|
], |
867
|
|
|
'result' => [ |
868
|
|
|
[ |
869
|
|
|
'i', |
870
|
|
|
'int(11)', |
871
|
|
|
'NO', |
872
|
|
|
'PRI', |
873
|
|
|
'NULL', |
874
|
|
|
'auto_increment', |
875
|
|
|
'select,insert,update,references', |
876
|
|
|
'', |
877
|
|
|
], |
878
|
|
|
[ |
879
|
|
|
'o', |
880
|
|
|
'varchar(100)', |
881
|
|
|
'NO', |
882
|
|
|
'MUL', |
883
|
|
|
'NULL', |
884
|
|
|
'', |
885
|
|
|
'select,insert,update,references', |
886
|
|
|
'', |
887
|
|
|
], |
888
|
|
|
], |
889
|
|
|
], |
890
|
|
|
[ |
891
|
|
|
'query' => 'SELECT `CHARACTER_SET_NAME` AS `Charset`,' |
892
|
|
|
. ' `DEFAULT_COLLATE_NAME` AS `Default collation`,' |
893
|
|
|
. ' `DESCRIPTION` AS `Description`,' |
894
|
|
|
. ' `MAXLEN` AS `Maxlen`' |
895
|
|
|
. ' FROM `information_schema`.`CHARACTER_SETS`', |
896
|
|
|
'columns' => [ |
897
|
|
|
'Charset', |
898
|
|
|
'Default collation', |
899
|
|
|
'Description', |
900
|
|
|
'Maxlen', |
901
|
|
|
], |
902
|
|
|
'result' => [ |
903
|
|
|
[ |
904
|
|
|
'armscii8', |
905
|
|
|
'ARMSCII-8 Armenian', |
906
|
|
|
'armscii8_general_ci', |
907
|
|
|
'1', |
908
|
|
|
], |
909
|
|
|
[ |
910
|
|
|
'utf8', |
911
|
|
|
'utf8_general_ci', |
912
|
|
|
'UTF-8 Unicode', |
913
|
|
|
'3', |
914
|
|
|
], |
915
|
|
|
[ |
916
|
|
|
'utf8mb4', |
917
|
|
|
'UTF-8 Unicode', |
918
|
|
|
'utf8mb4_0900_ai_ci', |
919
|
|
|
'4', |
920
|
|
|
], |
921
|
|
|
[ |
922
|
|
|
'latin1', |
923
|
|
|
'latin1_swedish_ci', |
924
|
|
|
'cp1252 West European', |
925
|
|
|
'1', |
926
|
|
|
], |
927
|
|
|
], |
928
|
|
|
], |
929
|
|
|
[ |
930
|
|
|
'query' => 'SELECT `COLLATION_NAME` AS `Collation`,' |
931
|
|
|
. ' `CHARACTER_SET_NAME` AS `Charset`,' |
932
|
|
|
. ' `ID` AS `Id`,' |
933
|
|
|
. ' `IS_DEFAULT` AS `Default`,' |
934
|
|
|
. ' `IS_COMPILED` AS `Compiled`,' |
935
|
|
|
. ' `SORTLEN` AS `Sortlen`' |
936
|
|
|
. ' FROM `information_schema`.`COLLATIONS`', |
937
|
|
|
'columns' => [ |
938
|
|
|
'Collation', |
939
|
|
|
'Charset', |
940
|
|
|
'Id', |
941
|
|
|
'Default', |
942
|
|
|
'Compiled', |
943
|
|
|
'Sortlen', |
944
|
|
|
], |
945
|
|
|
'result' => [ |
946
|
|
|
[ |
947
|
|
|
'utf8mb4_general_ci', |
948
|
|
|
'utf8mb4', |
949
|
|
|
'45', |
950
|
|
|
'Yes', |
951
|
|
|
'Yes', |
952
|
|
|
'1', |
953
|
|
|
], |
954
|
|
|
[ |
955
|
|
|
'armscii8_general_ci', |
956
|
|
|
'armscii8', |
957
|
|
|
'32', |
958
|
|
|
'Yes', |
959
|
|
|
'Yes', |
960
|
|
|
'1', |
961
|
|
|
], |
962
|
|
|
[ |
963
|
|
|
'utf8_general_ci', |
964
|
|
|
'utf8', |
965
|
|
|
'33', |
966
|
|
|
'Yes', |
967
|
|
|
'Yes', |
968
|
|
|
'1', |
969
|
|
|
], |
970
|
|
|
[ |
971
|
|
|
'utf8_bin', |
972
|
|
|
'utf8', |
973
|
|
|
'83', |
974
|
|
|
'', |
975
|
|
|
'Yes', |
976
|
|
|
'1', |
977
|
|
|
], |
978
|
|
|
[ |
979
|
|
|
'latin1_swedish_ci', |
980
|
|
|
'latin1', |
981
|
|
|
'8', |
982
|
|
|
'Yes', |
983
|
|
|
'Yes', |
984
|
|
|
'1', |
985
|
|
|
], |
986
|
|
|
], |
987
|
|
|
], |
988
|
|
|
[ |
989
|
|
|
'query' => 'SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`TABLES`' |
990
|
|
|
. ' WHERE `TABLE_SCHEMA`=\'pma_test\' AND `TABLE_TYPE` IN (\'BASE TABLE\', \'SYSTEM VERSIONED\')', |
991
|
|
|
'result' => [], |
992
|
|
|
], |
993
|
|
|
[ |
994
|
|
|
'query' => 'SELECT `column_name`, `mimetype`, `transformation`,' |
995
|
|
|
. ' `transformation_options`, `input_transformation`,' |
996
|
|
|
. ' `input_transformation_options`' |
997
|
|
|
. ' FROM `pmadb`.`column_info`' |
998
|
|
|
. ' WHERE `db_name` = \'pma_test\' AND `table_name` = \'table1\'' |
999
|
|
|
. ' AND ( `mimetype` != \'\' OR `transformation` != \'\'' |
1000
|
|
|
. ' OR `transformation_options` != \'\'' |
1001
|
|
|
. ' OR `input_transformation` != \'\'' |
1002
|
|
|
. ' OR `input_transformation_options` != \'\')', |
1003
|
|
|
'columns' => [ |
1004
|
|
|
'column_name', |
1005
|
|
|
'mimetype', |
1006
|
|
|
'transformation', |
1007
|
|
|
'transformation_options', |
1008
|
|
|
'input_transformation', |
1009
|
|
|
'input_transformation_options', |
1010
|
|
|
], |
1011
|
|
|
'result' => [ |
1012
|
|
|
[ |
1013
|
|
|
'o', |
1014
|
|
|
'text/plain', |
1015
|
|
|
'sql', |
1016
|
|
|
'', |
1017
|
|
|
'regex', |
1018
|
|
|
'/pma/i', |
1019
|
|
|
], |
1020
|
|
|
[ |
1021
|
|
|
'col', |
1022
|
|
|
't', |
1023
|
|
|
'o/p', |
1024
|
|
|
'', |
1025
|
|
|
'i/p', |
1026
|
|
|
'', |
1027
|
|
|
], |
1028
|
|
|
], |
1029
|
|
|
], |
1030
|
|
|
[ |
1031
|
|
|
'query' => 'SELECT `column_name`, `mimetype`, `transformation`,' |
1032
|
|
|
. ' `transformation_options`, `input_transformation`,' |
1033
|
|
|
. ' `input_transformation_options`' |
1034
|
|
|
. ' FROM `information_schema`.`column_info`' |
1035
|
|
|
. ' WHERE `db_name` = \'my_db\' AND `table_name` = \'test_tbl\'' |
1036
|
|
|
. ' AND ( `mimetype` != \'\' OR `transformation` != \'\'' |
1037
|
|
|
. ' OR `transformation_options` != \'\'' |
1038
|
|
|
. ' OR `input_transformation` != \'\'' |
1039
|
|
|
. ' OR `input_transformation_options` != \'\')', |
1040
|
|
|
'columns' => [ |
1041
|
|
|
'column_name', |
1042
|
|
|
'mimetype', |
1043
|
|
|
'transformation', |
1044
|
|
|
'transformation_options', |
1045
|
|
|
'input_transformation', |
1046
|
|
|
'input_transformation_options', |
1047
|
|
|
], |
1048
|
|
|
'result' => [ |
1049
|
|
|
[ |
1050
|
|
|
'vc', |
1051
|
|
|
'', |
1052
|
|
|
'output/text_plain_json.php', |
1053
|
|
|
'', |
1054
|
|
|
'Input/Text_Plain_JsonEditor.php', |
1055
|
|
|
'', |
1056
|
|
|
], |
1057
|
|
|
[ |
1058
|
|
|
'vc', |
1059
|
|
|
'', |
1060
|
|
|
'output/text_plain_formatted.php', |
1061
|
|
|
'', |
1062
|
|
|
'Text_Plain_Substring.php', |
1063
|
|
|
'1', |
1064
|
|
|
], |
1065
|
|
|
], |
1066
|
|
|
], |
1067
|
|
|
[ |
1068
|
|
|
'query' => 'SELECT CONCAT(`db_name`, \'.\', `table_name`, \'.\', `column_name`) AS column_name, `mimetype`, `transformation`,' |
1069
|
|
|
. ' `transformation_options`, `input_transformation`,' |
1070
|
|
|
. ' `input_transformation_options`' |
1071
|
|
|
. ' FROM `information_schema`.`column_info`' |
1072
|
|
|
. ' WHERE `db_name` = \'my_db\' AND `table_name` = \'\'' |
1073
|
|
|
. ' AND ( `mimetype` != \'\' OR `transformation` != \'\'' |
1074
|
|
|
. ' OR `transformation_options` != \'\'' |
1075
|
|
|
. ' OR `input_transformation` != \'\'' |
1076
|
|
|
. ' OR `input_transformation_options` != \'\')', |
1077
|
|
|
'columns' => [ |
1078
|
|
|
'column_name', |
1079
|
|
|
'mimetype', |
1080
|
|
|
'transformation', |
1081
|
|
|
'transformation_options', |
1082
|
|
|
'input_transformation', |
1083
|
|
|
'input_transformation_options', |
1084
|
|
|
], |
1085
|
|
|
'result' => [ |
1086
|
|
|
[ |
1087
|
|
|
'vc', |
1088
|
|
|
'', |
1089
|
|
|
'output/text_plain_json.php', |
1090
|
|
|
'', |
1091
|
|
|
'Input/Text_Plain_JsonEditor.php', |
1092
|
|
|
'', |
1093
|
|
|
], |
1094
|
|
|
[ |
1095
|
|
|
'vc', |
1096
|
|
|
'', |
1097
|
|
|
'output/text_plain_formatted.php', |
1098
|
|
|
'', |
1099
|
|
|
'Text_Plain_Substring.php', |
1100
|
|
|
'1', |
1101
|
|
|
], |
1102
|
|
|
], |
1103
|
|
|
], |
1104
|
|
|
[ |
1105
|
|
|
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS' |
1106
|
|
|
. ' WHERE TABLE_SCHEMA = \'pma_test\' AND TABLE_NAME = \'table1\'', |
1107
|
|
|
'result' => [], |
1108
|
|
|
], |
1109
|
|
|
[ |
1110
|
|
|
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS' |
1111
|
|
|
. ' WHERE TABLE_SCHEMA = \'ODS_DB\' AND TABLE_NAME = \'Shop\'', |
1112
|
|
|
'result' => [], |
1113
|
|
|
], |
1114
|
|
|
[ |
1115
|
|
|
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS' |
1116
|
|
|
. ' WHERE TABLE_SCHEMA = \'ODS_DB\' AND TABLE_NAME = \'pma_bookmark\'', |
1117
|
|
|
'result' => [], |
1118
|
|
|
], |
1119
|
|
|
[ |
1120
|
|
|
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS' |
1121
|
|
|
. ' WHERE TABLE_SCHEMA = \'ODS_DB\' AND TABLE_NAME = \'Feuille 1\'', |
1122
|
|
|
'result' => [], |
1123
|
|
|
], |
1124
|
|
|
[ |
1125
|
|
|
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS' |
1126
|
|
|
. ' WHERE TABLE_SCHEMA = \'my_dataset\' AND TABLE_NAME = \'company_users\'', |
1127
|
|
|
'result' => [], |
1128
|
|
|
], |
1129
|
|
|
[ |
1130
|
|
|
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS' |
1131
|
|
|
. ' WHERE TABLE_SCHEMA = \'my_db\' ' |
1132
|
|
|
. 'AND TABLE_NAME = \'test_tbl\' AND IS_UPDATABLE = \'YES\'', |
1133
|
|
|
'result' => [], |
1134
|
|
|
], |
1135
|
|
|
[ |
1136
|
|
|
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,' |
1137
|
|
|
. ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,' |
1138
|
|
|
. ' `ENGINE` AS `Type`, `VERSION` AS `Version`,' |
1139
|
|
|
. ' `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`,' |
1140
|
|
|
. ' `AVG_ROW_LENGTH` AS `Avg_row_length`,' |
1141
|
|
|
. ' `DATA_LENGTH` AS `Data_length`,' |
1142
|
|
|
. ' `MAX_DATA_LENGTH` AS `Max_data_length`,' |
1143
|
|
|
. ' `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,' |
1144
|
|
|
. ' `AUTO_INCREMENT` AS `Auto_increment`,' |
1145
|
|
|
. ' `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`,' |
1146
|
|
|
. ' `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`,' |
1147
|
|
|
. ' `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`,' |
1148
|
|
|
. ' `TABLE_COMMENT` AS `Comment`' |
1149
|
|
|
. ' FROM `information_schema`.`TABLES` t' |
1150
|
|
|
. ' WHERE `TABLE_SCHEMA` IN (\'pma_test\')' |
1151
|
|
|
. ' AND t.`TABLE_NAME` = \'table1\' ORDER BY Name ASC', |
1152
|
|
|
'columns' => [ |
1153
|
|
|
'TABLE_CATALOG', |
1154
|
|
|
'TABLE_SCHEMA', |
1155
|
|
|
'TABLE_NAME', |
1156
|
|
|
'TABLE_TYPE', |
1157
|
|
|
'ENGINE', |
1158
|
|
|
'VERSION', |
1159
|
|
|
'ROW_FORMAT', |
1160
|
|
|
'TABLE_ROWS', |
1161
|
|
|
'AVG_ROW_LENGTH', |
1162
|
|
|
'DATA_LENGTH', |
1163
|
|
|
'MAX_DATA_LENGTH', |
1164
|
|
|
'INDEX_LENGTH', |
1165
|
|
|
'DATA_FREE', |
1166
|
|
|
'AUTO_INCREMENT', |
1167
|
|
|
'CREATE_TIME', |
1168
|
|
|
'UPDATE_TIME', |
1169
|
|
|
'CHECK_TIME', |
1170
|
|
|
'TABLE_COLLATION', |
1171
|
|
|
'CHECKSUM', |
1172
|
|
|
'CREATE_OPTIONS', |
1173
|
|
|
'TABLE_COMMENT', |
1174
|
|
|
'Db', |
1175
|
|
|
'Name', |
1176
|
|
|
'TABLE_TYPE', |
1177
|
|
|
'Engine', |
1178
|
|
|
'Type', |
1179
|
|
|
'Version', |
1180
|
|
|
'Row_format', |
1181
|
|
|
'Rows', |
1182
|
|
|
'Avg_row_length', |
1183
|
|
|
'Data_length', |
1184
|
|
|
'Max_data_length', |
1185
|
|
|
'Index_length', |
1186
|
|
|
'Data_free', |
1187
|
|
|
'Auto_increment', |
1188
|
|
|
'Create_time', |
1189
|
|
|
'Update_time', |
1190
|
|
|
'Check_time', |
1191
|
|
|
'Collation', |
1192
|
|
|
'Checksum', |
1193
|
|
|
'Create_options', |
1194
|
|
|
'Comment', |
1195
|
|
|
], |
1196
|
|
|
'result' => [ |
1197
|
|
|
[ |
1198
|
|
|
'def', |
1199
|
|
|
'smash', |
1200
|
|
|
'issues_issue', |
1201
|
|
|
'BASE TABLE', |
1202
|
|
|
'InnoDB', |
1203
|
|
|
'10', |
1204
|
|
|
'Compact', |
1205
|
|
|
'9136', |
1206
|
|
|
'862', |
1207
|
|
|
'7880704', |
1208
|
|
|
'0', |
1209
|
|
|
'1032192', |
1210
|
|
|
'420478976', |
1211
|
|
|
'155862', |
1212
|
|
|
'2012-08-29 13:28:28', |
1213
|
|
|
'NULL', |
1214
|
|
|
'NULL', |
1215
|
|
|
'utf8_general_ci', |
1216
|
|
|
'NULL', |
1217
|
|
|
'', |
1218
|
|
|
'', |
1219
|
|
|
'smash', |
1220
|
|
|
'issues_issue', |
1221
|
|
|
'BASE TABLE', |
1222
|
|
|
'InnoDB', |
1223
|
|
|
'InnoDB', |
1224
|
|
|
'10', |
1225
|
|
|
'Compact', |
1226
|
|
|
'9136', |
1227
|
|
|
'862', |
1228
|
|
|
'7880704', |
1229
|
|
|
'0', |
1230
|
|
|
'1032192', |
1231
|
|
|
'420478976', |
1232
|
|
|
'155862', |
1233
|
|
|
'2012-08-29 13:28:28', |
1234
|
|
|
'NULL', |
1235
|
|
|
'NULL', |
1236
|
|
|
'utf8_general_ci', |
1237
|
|
|
'NULL', |
1238
|
|
|
], |
1239
|
|
|
], |
1240
|
|
|
], |
1241
|
|
|
[ |
1242
|
|
|
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,' |
1243
|
|
|
. ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,' |
1244
|
|
|
. ' `ENGINE` AS `Type`, `VERSION` AS `Version`,' |
1245
|
|
|
. ' `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`,' |
1246
|
|
|
. ' `AVG_ROW_LENGTH` AS `Avg_row_length`,' |
1247
|
|
|
. ' `DATA_LENGTH` AS `Data_length`,' |
1248
|
|
|
. ' `MAX_DATA_LENGTH` AS `Max_data_length`,' |
1249
|
|
|
. ' `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,' |
1250
|
|
|
. ' `AUTO_INCREMENT` AS `Auto_increment`,' |
1251
|
|
|
. ' `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`,' |
1252
|
|
|
. ' `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`,' |
1253
|
|
|
. ' `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`,' |
1254
|
|
|
. ' `TABLE_COMMENT` AS `Comment`' |
1255
|
|
|
. ' FROM `information_schema`.`TABLES` t' |
1256
|
|
|
. ' WHERE `TABLE_SCHEMA` IN (\'pma_test\')' |
1257
|
|
|
. ' AND t.`TABLE_NAME` = \'table1\' ORDER BY Name ASC', |
1258
|
|
|
'columns' => [ |
1259
|
|
|
'TABLE_CATALOG', |
1260
|
|
|
'TABLE_SCHEMA', |
1261
|
|
|
'TABLE_NAME', |
1262
|
|
|
'TABLE_TYPE', |
1263
|
|
|
'ENGINE', |
1264
|
|
|
'VERSION', |
1265
|
|
|
'ROW_FORMAT', |
1266
|
|
|
'TABLE_ROWS', |
1267
|
|
|
'AVG_ROW_LENGTH', |
1268
|
|
|
'DATA_LENGTH', |
1269
|
|
|
'MAX_DATA_LENGTH', |
1270
|
|
|
'INDEX_LENGTH', |
1271
|
|
|
'DATA_FREE', |
1272
|
|
|
'AUTO_INCREMENT', |
1273
|
|
|
'CREATE_TIME', |
1274
|
|
|
'UPDATE_TIME', |
1275
|
|
|
'CHECK_TIME', |
1276
|
|
|
'TABLE_COLLATION', |
1277
|
|
|
'CHECKSUM', |
1278
|
|
|
'CREATE_OPTIONS', |
1279
|
|
|
'TABLE_COMMENT', |
1280
|
|
|
'Db', |
1281
|
|
|
'Name', |
1282
|
|
|
'TABLE_TYPE', |
1283
|
|
|
'Engine', |
1284
|
|
|
'Type', |
1285
|
|
|
'Version', |
1286
|
|
|
'Row_format', |
1287
|
|
|
'Rows', |
1288
|
|
|
'Avg_row_length', |
1289
|
|
|
'Data_length', |
1290
|
|
|
'Max_data_length', |
1291
|
|
|
'Index_length', |
1292
|
|
|
'Data_free', |
1293
|
|
|
'Auto_increment', |
1294
|
|
|
'Create_time', |
1295
|
|
|
'Update_time', |
1296
|
|
|
'Check_time', |
1297
|
|
|
'Collation', |
1298
|
|
|
'Checksum', |
1299
|
|
|
'Create_options', |
1300
|
|
|
'Comment', |
1301
|
|
|
], |
1302
|
|
|
'result' => [ |
1303
|
|
|
[ |
1304
|
|
|
'def', |
1305
|
|
|
'smash', |
1306
|
|
|
'issues_issue', |
1307
|
|
|
'BASE TABLE', |
1308
|
|
|
'InnoDB', |
1309
|
|
|
'10', |
1310
|
|
|
'Compact', |
1311
|
|
|
'9136', |
1312
|
|
|
'862', |
1313
|
|
|
'7880704', |
1314
|
|
|
'0', |
1315
|
|
|
'1032192', |
1316
|
|
|
'420478976', |
1317
|
|
|
'155862', |
1318
|
|
|
'2012-08-29 13:28:28', |
1319
|
|
|
'NULL', |
1320
|
|
|
'NULL', |
1321
|
|
|
'utf8_general_ci', |
1322
|
|
|
'NULL', |
1323
|
|
|
'', |
1324
|
|
|
'', |
1325
|
|
|
'smash', |
1326
|
|
|
'issues_issue', |
1327
|
|
|
'BASE TABLE', |
1328
|
|
|
'InnoDB', |
1329
|
|
|
'InnoDB', |
1330
|
|
|
'10', |
1331
|
|
|
'Compact', |
1332
|
|
|
'9136', |
1333
|
|
|
'862', |
1334
|
|
|
'7880704', |
1335
|
|
|
'0', |
1336
|
|
|
'1032192', |
1337
|
|
|
'420478976', |
1338
|
|
|
'155862', |
1339
|
|
|
'2012-08-29 13:28:28', |
1340
|
|
|
'NULL', |
1341
|
|
|
'NULL', |
1342
|
|
|
'utf8_general_ci', |
1343
|
|
|
'NULL', |
1344
|
|
|
], |
1345
|
|
|
], |
1346
|
|
|
], |
1347
|
|
|
[ |
1348
|
|
|
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,' |
1349
|
|
|
. ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,' |
1350
|
|
|
. ' `ENGINE` AS `Type`, `VERSION` AS `Version`,' |
1351
|
|
|
. ' `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`,' |
1352
|
|
|
. ' `AVG_ROW_LENGTH` AS `Avg_row_length`,' |
1353
|
|
|
. ' `DATA_LENGTH` AS `Data_length`,' |
1354
|
|
|
. ' `MAX_DATA_LENGTH` AS `Max_data_length`,' |
1355
|
|
|
. ' `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,' |
1356
|
|
|
. ' `AUTO_INCREMENT` AS `Auto_increment`,' |
1357
|
|
|
. ' `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`,' |
1358
|
|
|
. ' `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`,' |
1359
|
|
|
. ' `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`,' |
1360
|
|
|
. ' `TABLE_COMMENT` AS `Comment`' |
1361
|
|
|
. ' FROM `information_schema`.`TABLES` t' |
1362
|
|
|
. ' WHERE `TABLE_SCHEMA` IN (\'my_db\')' |
1363
|
|
|
. ' AND t.`TABLE_NAME` = \'test_tbl\' ORDER BY Name ASC', |
1364
|
|
|
'columns' => [ |
1365
|
|
|
'TABLE_CATALOG', |
1366
|
|
|
'TABLE_SCHEMA', |
1367
|
|
|
'TABLE_NAME', |
1368
|
|
|
'TABLE_TYPE', |
1369
|
|
|
'ENGINE', |
1370
|
|
|
'VERSION', |
1371
|
|
|
'ROW_FORMAT', |
1372
|
|
|
'TABLE_ROWS', |
1373
|
|
|
'AVG_ROW_LENGTH', |
1374
|
|
|
'DATA_LENGTH', |
1375
|
|
|
'MAX_DATA_LENGTH', |
1376
|
|
|
'INDEX_LENGTH', |
1377
|
|
|
'DATA_FREE', |
1378
|
|
|
'AUTO_INCREMENT', |
1379
|
|
|
'CREATE_TIME', |
1380
|
|
|
'UPDATE_TIME', |
1381
|
|
|
'CHECK_TIME', |
1382
|
|
|
'TABLE_COLLATION', |
1383
|
|
|
'CHECKSUM', |
1384
|
|
|
'CREATE_OPTIONS', |
1385
|
|
|
'TABLE_COMMENT', |
1386
|
|
|
'Db', |
1387
|
|
|
'Name', |
1388
|
|
|
'TABLE_TYPE', |
1389
|
|
|
'Engine', |
1390
|
|
|
'Type', |
1391
|
|
|
'Version', |
1392
|
|
|
'Row_format', |
1393
|
|
|
'Rows', |
1394
|
|
|
'Avg_row_length', |
1395
|
|
|
'Data_length', |
1396
|
|
|
'Max_data_length', |
1397
|
|
|
'Index_length', |
1398
|
|
|
'Data_free', |
1399
|
|
|
'Auto_increment', |
1400
|
|
|
'Create_time', |
1401
|
|
|
'Update_time', |
1402
|
|
|
'Check_time', |
1403
|
|
|
'Collation', |
1404
|
|
|
'Checksum', |
1405
|
|
|
'Create_options', |
1406
|
|
|
'Comment', |
1407
|
|
|
], |
1408
|
|
|
'result' => [], |
1409
|
|
|
], |
1410
|
|
|
[ |
1411
|
|
|
'query' => 'SELECT COUNT(*) FROM `pma_test`.`table1`', |
1412
|
|
|
'result' => [[0]], |
1413
|
|
|
], |
1414
|
|
|
[ |
1415
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1416
|
|
|
. '`USER_PRIVILEGES`' |
1417
|
|
|
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\'' |
1418
|
|
|
. ' AND PRIVILEGE_TYPE=\'TRIGGER\'', |
1419
|
|
|
'result' => [], |
1420
|
|
|
], |
1421
|
|
|
[ |
1422
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1423
|
|
|
. '`SCHEMA_PRIVILEGES`' |
1424
|
|
|
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\'' |
1425
|
|
|
. ' AND PRIVILEGE_TYPE=\'TRIGGER\' AND \'pma_test\'' |
1426
|
|
|
. ' LIKE `TABLE_SCHEMA`', |
1427
|
|
|
'result' => [], |
1428
|
|
|
], |
1429
|
|
|
[ |
1430
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1431
|
|
|
. '`TABLE_PRIVILEGES`' |
1432
|
|
|
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\'' |
1433
|
|
|
. ' AND PRIVILEGE_TYPE=\'TRIGGER\' AND \'pma_test\'' |
1434
|
|
|
. ' LIKE `TABLE_SCHEMA` AND TABLE_NAME=\'table1\'', |
1435
|
|
|
'result' => [], |
1436
|
|
|
], |
1437
|
|
|
[ |
1438
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1439
|
|
|
. '`USER_PRIVILEGES`' |
1440
|
|
|
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\'' |
1441
|
|
|
. ' AND PRIVILEGE_TYPE=\'EVENT\'', |
1442
|
|
|
'result' => [], |
1443
|
|
|
], |
1444
|
|
|
[ |
1445
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1446
|
|
|
. '`SCHEMA_PRIVILEGES`' |
1447
|
|
|
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\'' |
1448
|
|
|
. ' AND PRIVILEGE_TYPE=\'EVENT\' AND \'pma_test\'' |
1449
|
|
|
. ' LIKE `TABLE_SCHEMA`', |
1450
|
|
|
'result' => [], |
1451
|
|
|
], |
1452
|
|
|
[ |
1453
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1454
|
|
|
. '`TABLE_PRIVILEGES`' |
1455
|
|
|
. ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\'' |
1456
|
|
|
. ' AND PRIVILEGE_TYPE=\'EVENT\'' |
1457
|
|
|
. ' AND TABLE_SCHEMA=\'pma\\\\_test\' AND TABLE_NAME=\'table1\'', |
1458
|
|
|
'result' => [], |
1459
|
|
|
], |
1460
|
|
|
[ |
1461
|
|
|
'query' => 'RENAME TABLE `pma_test`.`table1` TO `pma_test`.`table3`;', |
1462
|
|
|
'result' => [], |
1463
|
|
|
], |
1464
|
|
|
[ |
1465
|
|
|
'query' => 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION,' |
1466
|
|
|
. ' EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT, ' |
1467
|
|
|
. 'EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER' |
1468
|
|
|
. ' FROM information_schema.TRIGGERS' |
1469
|
|
|
. ' WHERE EVENT_OBJECT_SCHEMA= \'pma_test\'' |
1470
|
|
|
. ' AND EVENT_OBJECT_TABLE = \'table1\';', |
1471
|
|
|
'result' => [], |
1472
|
|
|
], |
1473
|
|
|
[ |
1474
|
|
|
'query' => 'SHOW TABLES FROM `pma`;', |
1475
|
|
|
'result' => [], |
1476
|
|
|
], |
1477
|
|
|
[ |
1478
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1479
|
|
|
. "`SCHEMA_PRIVILEGES` WHERE GRANTEE='''pma_test''@''localhost'''" |
1480
|
|
|
. " AND PRIVILEGE_TYPE='EVENT' AND TABLE_SCHEMA='pma'", |
1481
|
|
|
'result' => [], |
1482
|
|
|
], |
1483
|
|
|
[ |
1484
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1485
|
|
|
. "`SCHEMA_PRIVILEGES` WHERE GRANTEE='''pma_test''@''localhost'''" |
1486
|
|
|
. " AND PRIVILEGE_TYPE='TRIGGER' AND TABLE_SCHEMA='pma'", |
1487
|
|
|
'result' => [], |
1488
|
|
|
], |
1489
|
|
|
[ |
1490
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.' |
1491
|
|
|
. "`TABLE_PRIVILEGES` WHERE GRANTEE='''pma_test''@''localhost'''" |
1492
|
|
|
. " AND PRIVILEGE_TYPE='TRIGGER' AND 'db' LIKE `TABLE_SCHEMA` AND TABLE_NAME='table'", |
1493
|
|
|
'result' => [], |
1494
|
|
|
], |
1495
|
|
|
[ |
1496
|
|
|
'query' => 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA' |
1497
|
|
|
. ' WHERE SCHEMA_NAME = \'pma_test\' LIMIT 1', |
1498
|
|
|
'columns' => ['DEFAULT_COLLATION_NAME'], |
1499
|
|
|
'result' => [ |
1500
|
|
|
['utf8_general_ci'], |
1501
|
|
|
], |
1502
|
|
|
], |
1503
|
|
|
[ |
1504
|
|
|
'query' => 'SELECT @@collation_database', |
1505
|
|
|
'columns' => ['@@collation_database'], |
1506
|
|
|
'result' => [ |
1507
|
|
|
['bar'], |
1508
|
|
|
], |
1509
|
|
|
], |
1510
|
|
|
[ |
1511
|
|
|
'query' => 'SHOW TABLES FROM `phpmyadmin`', |
1512
|
|
|
'result' => [], |
1513
|
|
|
], |
1514
|
|
|
[ |
1515
|
|
|
'query' => 'SELECT tracking_active FROM `pmadb`.`tracking`' . |
1516
|
|
|
" WHERE db_name = 'pma_test_db'" . |
1517
|
|
|
" AND table_name = 'pma_test_table'" . |
1518
|
|
|
' ORDER BY version DESC LIMIT 1', |
1519
|
|
|
'columns' => ['tracking_active'], |
1520
|
|
|
'result' => [ |
1521
|
|
|
[1], |
1522
|
|
|
], |
1523
|
|
|
], |
1524
|
|
|
[ |
1525
|
|
|
'query' => 'SELECT tracking_active FROM `pmadb`.`tracking`' . |
1526
|
|
|
" WHERE db_name = 'pma_test_db'" . |
1527
|
|
|
" AND table_name = 'pma_test_table2'" . |
1528
|
|
|
' ORDER BY version DESC LIMIT 1', |
1529
|
|
|
'result' => [], |
1530
|
|
|
], |
1531
|
|
|
[ |
1532
|
|
|
'query' => 'SHOW SLAVE STATUS', |
1533
|
|
|
'result' => [ |
1534
|
|
|
[ |
1535
|
|
|
'Slave_IO_State' => 'running', |
1536
|
|
|
'Master_Host' => 'localhost', |
1537
|
|
|
'Master_User' => 'Master_User', |
1538
|
|
|
'Master_Port' => '1002', |
1539
|
|
|
'Connect_Retry' => 'Connect_Retry', |
1540
|
|
|
'Master_Log_File' => 'Master_Log_File', |
1541
|
|
|
'Read_Master_Log_Pos' => 'Read_Master_Log_Pos', |
1542
|
|
|
'Relay_Log_File' => 'Relay_Log_File', |
1543
|
|
|
'Relay_Log_Pos' => 'Relay_Log_Pos', |
1544
|
|
|
'Relay_Master_Log_File' => 'Relay_Master_Log_File', |
1545
|
|
|
'Slave_IO_Running' => 'NO', |
1546
|
|
|
'Slave_SQL_Running' => 'NO', |
1547
|
|
|
'Replicate_Do_DB' => 'Replicate_Do_DB', |
1548
|
|
|
'Replicate_Ignore_DB' => 'Replicate_Ignore_DB', |
1549
|
|
|
'Replicate_Do_Table' => 'Replicate_Do_Table', |
1550
|
|
|
'Replicate_Ignore_Table' => 'Replicate_Ignore_Table', |
1551
|
|
|
'Replicate_Wild_Do_Table' => 'Replicate_Wild_Do_Table', |
1552
|
|
|
'Replicate_Wild_Ignore_Table' => 'Replicate_Wild_Ignore_Table', |
1553
|
|
|
'Last_Errno' => 'Last_Errno', |
1554
|
|
|
'Last_Error' => 'Last_Error', |
1555
|
|
|
'Skip_Counter' => 'Skip_Counter', |
1556
|
|
|
'Exec_Master_Log_Pos' => 'Exec_Master_Log_Pos', |
1557
|
|
|
'Relay_Log_Space' => 'Relay_Log_Space', |
1558
|
|
|
'Until_Condition' => 'Until_Condition', |
1559
|
|
|
'Until_Log_File' => 'Until_Log_File', |
1560
|
|
|
'Until_Log_Pos' => 'Until_Log_Pos', |
1561
|
|
|
'Master_SSL_Allowed' => 'Master_SSL_Allowed', |
1562
|
|
|
'Master_SSL_CA_File' => 'Master_SSL_CA_File', |
1563
|
|
|
'Master_SSL_CA_Path' => 'Master_SSL_CA_Path', |
1564
|
|
|
'Master_SSL_Cert' => 'Master_SSL_Cert', |
1565
|
|
|
'Master_SSL_Cipher' => 'Master_SSL_Cipher', |
1566
|
|
|
'Master_SSL_Key' => 'Master_SSL_Key', |
1567
|
|
|
'Seconds_Behind_Master' => 'Seconds_Behind_Master', |
1568
|
|
|
], |
1569
|
|
|
], |
1570
|
|
|
], |
1571
|
|
|
[ |
1572
|
|
|
'query' => 'SHOW MASTER STATUS', |
1573
|
|
|
'result' => [ |
1574
|
|
|
[ |
1575
|
|
|
'File' => 'primary-bin.000030', |
1576
|
|
|
'Position' => '107', |
1577
|
|
|
'Binlog_Do_DB' => 'Binlog_Do_DB', |
1578
|
|
|
'Binlog_Ignore_DB' => 'Binlog_Ignore_DB', |
1579
|
|
|
], |
1580
|
|
|
], |
1581
|
|
|
], |
1582
|
|
|
[ |
1583
|
|
|
'query' => 'SHOW GRANTS', |
1584
|
|
|
'result' => [], |
1585
|
|
|
], |
1586
|
|
|
[ |
1587
|
|
|
'query' => 'SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`, ' |
1588
|
|
|
. '(SELECT DB_first_level FROM ( SELECT DISTINCT ' |
1589
|
|
|
. "SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level " |
1590
|
|
|
. 'FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t ORDER BY ' |
1591
|
|
|
. 'DB_first_level ASC LIMIT 0, 100) t2 WHERE TRUE AND 1 = LOCATE(' |
1592
|
|
|
. "CONCAT(DB_first_level, '_'), CONCAT(SCHEMA_NAME, '_')) " |
1593
|
|
|
. 'ORDER BY SCHEMA_NAME ASC', |
1594
|
|
|
'columns' => ['SCHEMA_NAME'], |
1595
|
|
|
'result' => [ |
1596
|
|
|
['test'], |
1597
|
|
|
], |
1598
|
|
|
], |
1599
|
|
|
[ |
1600
|
|
|
'query' => 'SELECT COUNT(*) FROM ( SELECT DISTINCT SUBSTRING_INDEX(' |
1601
|
|
|
. "SCHEMA_NAME, '_', 1) DB_first_level " |
1602
|
|
|
. 'FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t', |
1603
|
|
|
'result' => [ |
1604
|
|
|
[1], |
1605
|
|
|
], |
1606
|
|
|
], |
1607
|
|
|
[ |
1608
|
|
|
'query' => 'SELECT `PARTITION_METHOD` ' |
1609
|
|
|
. 'FROM `information_schema`.`PARTITIONS` ' |
1610
|
|
|
. "WHERE `TABLE_SCHEMA` = 'db' AND `TABLE_NAME` = 'table' LIMIT 1", |
1611
|
|
|
'result' => [], |
1612
|
|
|
], |
1613
|
|
|
[ |
1614
|
|
|
'query' => 'SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS` WHERE ' |
1615
|
|
|
. '`TABLE_SCHEMA` = \'database\' AND `TABLE_NAME` = \'no_partition_method\' LIMIT 1', |
1616
|
|
|
'result' => [], |
1617
|
|
|
], |
1618
|
|
|
[ |
1619
|
|
|
'query' => 'SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS` WHERE ' |
1620
|
|
|
. '`TABLE_SCHEMA` = \'database\' AND `TABLE_NAME` = \'range_partition_method\' LIMIT 1', |
1621
|
|
|
'columns' => ['PARTITION_METHOD'], |
1622
|
|
|
'result' => [['RANGE']], |
1623
|
|
|
], |
1624
|
|
|
[ |
1625
|
|
|
'query' => 'SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS` WHERE ' |
1626
|
|
|
. '`TABLE_SCHEMA` = \'database\' AND `TABLE_NAME` = \'range_columns_partition_method\' LIMIT 1', |
1627
|
|
|
'columns' => ['PARTITION_METHOD'], |
1628
|
|
|
'result' => [['RANGE COLUMNS']], |
1629
|
|
|
], |
1630
|
|
|
[ |
1631
|
|
|
'query' => 'SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS` WHERE ' |
1632
|
|
|
. '`TABLE_SCHEMA` = \'database\' AND `TABLE_NAME` = \'list_partition_method\' LIMIT 1', |
1633
|
|
|
'columns' => ['PARTITION_METHOD'], |
1634
|
|
|
'result' => [['LIST']], |
1635
|
|
|
], |
1636
|
|
|
[ |
1637
|
|
|
'query' => 'SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS` WHERE ' |
1638
|
|
|
. '`TABLE_SCHEMA` = \'database\' AND `TABLE_NAME` = \'list_columns_partition_method\' LIMIT 1', |
1639
|
|
|
'columns' => ['PARTITION_METHOD'], |
1640
|
|
|
'result' => [['LIST COLUMNS']], |
1641
|
|
|
], |
1642
|
|
|
[ |
1643
|
|
|
'query' => 'SHOW PLUGINS', |
1644
|
|
|
'result' => [ |
1645
|
|
|
[ |
1646
|
|
|
'Name' => 'partition', |
1647
|
|
|
'Status' => 'ACTIVE', |
1648
|
|
|
'Type' => 'STORAGE ENGINE', |
1649
|
|
|
'Library' => null, |
1650
|
|
|
'License' => 'GPL', |
1651
|
|
|
], |
1652
|
|
|
], |
1653
|
|
|
], |
1654
|
|
|
[ |
1655
|
|
|
'query' => 'SELECT * FROM information_schema.PLUGINS ORDER BY PLUGIN_TYPE, PLUGIN_NAME', |
1656
|
|
|
'result' => [ |
1657
|
|
|
[ |
1658
|
|
|
'PLUGIN_NAME' => 'BLACKHOLE', |
1659
|
|
|
'PLUGIN_VERSION' => '1.0', |
1660
|
|
|
'PLUGIN_STATUS' => 'ACTIVE', |
1661
|
|
|
'PLUGIN_TYPE' => 'STORAGE ENGINE', |
1662
|
|
|
'PLUGIN_TYPE_VERSION' => '100316.0', |
1663
|
|
|
'PLUGIN_LIBRARY' => 'ha_blackhole.so', |
1664
|
|
|
'PLUGIN_LIBRARY_VERSION' => '1.13', |
1665
|
|
|
'PLUGIN_AUTHOR' => 'MySQL AB', |
1666
|
|
|
'PLUGIN_DESCRIPTION' => '/dev/null storage engine (anything you write to it disappears)', |
1667
|
|
|
'PLUGIN_LICENSE' => 'GPL', |
1668
|
|
|
'LOAD_OPTION' => 'ON', |
1669
|
|
|
'PLUGIN_MATURITY' => 'Stable', |
1670
|
|
|
'PLUGIN_AUTH_VERSION' => '1.0', |
1671
|
|
|
], |
1672
|
|
|
], |
1673
|
|
|
], |
1674
|
|
|
[ |
1675
|
|
|
'query' => "SHOW FULL TABLES FROM `default` WHERE `Table_type` IN('BASE TABLE', 'SYSTEM VERSIONED')", |
1676
|
|
|
'result' => [ |
1677
|
|
|
[ |
1678
|
|
|
'test1', |
1679
|
|
|
'BASE TABLE', |
1680
|
|
|
], |
1681
|
|
|
[ |
1682
|
|
|
'test2', |
1683
|
|
|
'BASE TABLE', |
1684
|
|
|
], |
1685
|
|
|
], |
1686
|
|
|
], |
1687
|
|
|
[ |
1688
|
|
|
'query' => 'SHOW FULL TABLES FROM `default` ' |
1689
|
|
|
. "WHERE `Table_type` NOT IN('BASE TABLE', 'SYSTEM VERSIONED')", |
1690
|
|
|
'result' => [], |
1691
|
|
|
], |
1692
|
|
|
[ |
1693
|
|
|
'query' => "SHOW FUNCTION STATUS WHERE `Db`='default'", |
1694
|
|
|
'result' => [['Name' => 'testFunction']], |
1695
|
|
|
], |
1696
|
|
|
[ |
1697
|
|
|
'query' => "SHOW PROCEDURE STATUS WHERE `Db`='default'", |
1698
|
|
|
'result' => [], |
1699
|
|
|
], |
1700
|
|
|
[ |
1701
|
|
|
'query' => 'SHOW EVENTS FROM `default`', |
1702
|
|
|
'result' => [], |
1703
|
|
|
], |
1704
|
|
|
[ |
1705
|
|
|
'query' => 'FLUSH PRIVILEGES', |
1706
|
|
|
'result' => [], |
1707
|
|
|
], |
1708
|
|
|
[ |
1709
|
|
|
'query' => 'SELECT * FROM `mysql`.`db` LIMIT 1', |
1710
|
|
|
'result' => [], |
1711
|
|
|
], |
1712
|
|
|
[ |
1713
|
|
|
'query' => 'SELECT * FROM `mysql`.`columns_priv` LIMIT 1', |
1714
|
|
|
'result' => [], |
1715
|
|
|
], |
1716
|
|
|
[ |
1717
|
|
|
'query' => 'SELECT * FROM `mysql`.`tables_priv` LIMIT 1', |
1718
|
|
|
'result' => [], |
1719
|
|
|
], |
1720
|
|
|
[ |
1721
|
|
|
'query' => 'SELECT * FROM `mysql`.`procs_priv` LIMIT 1', |
1722
|
|
|
'result' => [], |
1723
|
|
|
], |
1724
|
|
|
[ |
1725
|
|
|
'query' => 'DELETE FROM `mysql`.`db` WHERE `host` = "" AND `Db` = "" AND `User` = ""', |
1726
|
|
|
'result' => true, |
1727
|
|
|
], |
1728
|
|
|
[ |
1729
|
|
|
'query' => 'DELETE FROM `mysql`.`columns_priv` WHERE `host` = "" AND `Db` = "" AND `User` = ""', |
1730
|
|
|
'result' => true, |
1731
|
|
|
], |
1732
|
|
|
[ |
1733
|
|
|
'query' => 'DELETE FROM `mysql`.`tables_priv` WHERE ' |
1734
|
|
|
. '`host` = "" AND `Db` = "" AND `User` = "" AND Table_name = ""', |
1735
|
|
|
'result' => true, |
1736
|
|
|
], |
1737
|
|
|
[ |
1738
|
|
|
'query' => 'DELETE FROM `mysql`.`procs_priv` WHERE ' |
1739
|
|
|
. '`host` = "" AND `Db` = "" AND `User` = "" AND `Routine_name` = "" ' |
1740
|
|
|
. 'AND `Routine_type` = ""', |
1741
|
|
|
'result' => true, |
1742
|
|
|
], |
1743
|
|
|
[ |
1744
|
|
|
'query' => 'SELECT `plugin` FROM `mysql`.`user` WHERE ' |
1745
|
|
|
. '`User` = "pma_username" AND `Host` = "pma_hostname" LIMIT 1', |
1746
|
|
|
'result' => [], |
1747
|
|
|
], |
1748
|
|
|
[ |
1749
|
|
|
'query' => 'SELECT @@default_authentication_plugin', |
1750
|
|
|
'result' => [ |
1751
|
|
|
['@@default_authentication_plugin' => 'mysql_native_password'], |
1752
|
|
|
], |
1753
|
|
|
], |
1754
|
|
|
[ |
1755
|
|
|
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS WHERE ' |
1756
|
|
|
. "TABLE_SCHEMA = 'db' AND TABLE_NAME = 'table'", |
1757
|
|
|
'result' => [], |
1758
|
|
|
], |
1759
|
|
|
[ |
1760
|
|
|
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, ' |
1761
|
|
|
. '`TABLE_NAME` AS `Name`, `TABLE_TYPE` AS `TABLE_TYPE`, ' |
1762
|
|
|
. '`ENGINE` AS `Engine`, `ENGINE` AS `Type`, ' |
1763
|
|
|
. '`VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`, ' |
1764
|
|
|
. '`TABLE_ROWS` AS `Rows`, `AVG_ROW_LENGTH` AS `Avg_row_length`, ' |
1765
|
|
|
. '`DATA_LENGTH` AS `Data_length`, ' |
1766
|
|
|
. '`MAX_DATA_LENGTH` AS `Max_data_length`, ' |
1767
|
|
|
. '`INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`, ' |
1768
|
|
|
. '`AUTO_INCREMENT` AS `Auto_increment`, ' |
1769
|
|
|
. '`CREATE_TIME` AS `Create_time`, ' |
1770
|
|
|
. '`UPDATE_TIME` AS `Update_time`, `CHECK_TIME` AS `Check_time`, ' |
1771
|
|
|
. '`TABLE_COLLATION` AS `Collation`, `CHECKSUM` AS `Checksum`, ' |
1772
|
|
|
. '`CREATE_OPTIONS` AS `Create_options`, ' |
1773
|
|
|
. '`TABLE_COMMENT` AS `Comment` ' |
1774
|
|
|
. 'FROM `information_schema`.`TABLES` t ' |
1775
|
|
|
. "WHERE `TABLE_SCHEMA` IN ('db') " |
1776
|
|
|
. "AND t.`TABLE_NAME` = 'table' ORDER BY Name ASC", |
1777
|
|
|
'result' => [], |
1778
|
|
|
], |
1779
|
|
|
[ |
1780
|
|
|
'query' => "SHOW TABLE STATUS FROM `db` WHERE `Name` LIKE 'table%'", |
1781
|
|
|
'result' => [], |
1782
|
|
|
], |
1783
|
|
|
[ |
1784
|
|
|
'query' => "SHOW TABLE STATUS FROM `my_dataset` WHERE `Name` LIKE 'company\\\\_users%'", |
1785
|
|
|
'result' => [], |
1786
|
|
|
], |
1787
|
|
|
[ |
1788
|
|
|
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,' |
1789
|
|
|
. ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,' |
1790
|
|
|
. ' `ENGINE` AS `Type`, `VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`,' |
1791
|
|
|
. ' `TABLE_ROWS` AS `Rows`, `AVG_ROW_LENGTH` AS `Avg_row_length`,' |
1792
|
|
|
. ' `DATA_LENGTH` AS `Data_length`, `MAX_DATA_LENGTH` AS `Max_data_length`,' |
1793
|
|
|
. ' `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,' |
1794
|
|
|
. ' `AUTO_INCREMENT` AS `Auto_increment`, `CREATE_TIME` AS `Create_time`,' |
1795
|
|
|
. ' `UPDATE_TIME` AS `Update_time`, `CHECK_TIME` AS `Check_time`,' |
1796
|
|
|
. ' `TABLE_COLLATION` AS `Collation`, `CHECKSUM` AS `Checksum`,' |
1797
|
|
|
. ' `CREATE_OPTIONS` AS `Create_options`, `TABLE_COMMENT` AS `Comment`' |
1798
|
|
|
. " FROM `information_schema`.`TABLES` t WHERE `TABLE_SCHEMA` IN ('table1')" |
1799
|
|
|
. " AND t.`TABLE_NAME` = 'pma_test' ORDER BY Name ASC", |
1800
|
|
|
'columns' => [ |
1801
|
|
|
'TABLE_CATALOG', |
1802
|
|
|
'TABLE_SCHEMA', |
1803
|
|
|
'TABLE_NAME', |
1804
|
|
|
'TABLE_TYPE', |
1805
|
|
|
'ENGINE', |
1806
|
|
|
'VERSION', |
1807
|
|
|
'ROW_FORMAT', |
1808
|
|
|
'TABLE_ROWS', |
1809
|
|
|
'AVG_ROW_LENGTH', |
1810
|
|
|
'DATA_LENGTH', |
1811
|
|
|
'MAX_DATA_LENGTH', |
1812
|
|
|
'INDEX_LENGTH', |
1813
|
|
|
'DATA_FREE', |
1814
|
|
|
'AUTO_INCREMENT', |
1815
|
|
|
'CREATE_TIME', |
1816
|
|
|
'UPDATE_TIME', |
1817
|
|
|
'CHECK_TIME', |
1818
|
|
|
'TABLE_COLLATION', |
1819
|
|
|
'CHECKSUM', |
1820
|
|
|
'CREATE_OPTIONS', |
1821
|
|
|
'TABLE_COMMENT', |
1822
|
|
|
'Db', |
1823
|
|
|
'Name', |
1824
|
|
|
'TABLE_TYPE', |
1825
|
|
|
'Engine', |
1826
|
|
|
'Type', |
1827
|
|
|
'Version', |
1828
|
|
|
'Row_format', |
1829
|
|
|
'Rows', |
1830
|
|
|
'Avg_row_length', |
1831
|
|
|
'Data_length', |
1832
|
|
|
'Max_data_length', |
1833
|
|
|
'Index_length', |
1834
|
|
|
'Data_free', |
1835
|
|
|
'Auto_increment', |
1836
|
|
|
'Create_time', |
1837
|
|
|
'Update_time', |
1838
|
|
|
'Check_time', |
1839
|
|
|
'Collation', |
1840
|
|
|
'Checksum', |
1841
|
|
|
'Create_options', |
1842
|
|
|
'Comment', |
1843
|
|
|
], |
1844
|
|
|
'result' => [ |
1845
|
|
|
[ |
1846
|
|
|
'ref', |
1847
|
|
|
'pma_test', |
1848
|
|
|
'table1', |
1849
|
|
|
'BASE TABLE', |
1850
|
|
|
'DBIdummy', |
1851
|
|
|
'11', |
1852
|
|
|
'Redundant', |
1853
|
|
|
'123456', |
1854
|
|
|
'42', |
1855
|
|
|
'21708991', |
1856
|
|
|
'281474976710655',// MyISAM |
1857
|
|
|
'2048',// MyISAM |
1858
|
|
|
'2547', |
1859
|
|
|
'5', |
1860
|
|
|
'2014-06-24 17:30:00', |
1861
|
|
|
'2018-06-25 18:35:12', |
1862
|
|
|
'2015-04-24 19:30:59', |
1863
|
|
|
'utf8mb4_general_ci', |
1864
|
|
|
'3844432963', |
1865
|
|
|
'row_format=REDUNDANT', |
1866
|
|
|
'Test comment for "table1" in \'pma_test\'', |
1867
|
|
|
'table1', |
1868
|
|
|
'DBIdummy', |
1869
|
|
|
'11', |
1870
|
|
|
'Redundant', |
1871
|
|
|
'123456', |
1872
|
|
|
'42', |
1873
|
|
|
'21708991', |
1874
|
|
|
'281474976710655',// MyISAM |
1875
|
|
|
'2048',// MyISAM |
1876
|
|
|
'2547', |
1877
|
|
|
'5', |
1878
|
|
|
'2014-06-24 17:30:00', |
1879
|
|
|
'2018-06-25 18:35:12', |
1880
|
|
|
'2015-04-24 19:30:59', |
1881
|
|
|
'utf8mb4_general_ci', |
1882
|
|
|
'3844432963', |
1883
|
|
|
'row_format=REDUNDANT', |
1884
|
|
|
'Test comment for "table1" in \'pma_test\'', |
1885
|
|
|
], |
1886
|
|
|
], |
1887
|
|
|
], |
1888
|
|
|
[ |
1889
|
|
|
'query' => "SHOW TABLE STATUS FROM `table1` WHERE `Name` LIKE 'pma\_test%'", |
1890
|
|
|
'columns' => [ |
1891
|
|
|
'Name', |
1892
|
|
|
'TABLE_TYPE', |
1893
|
|
|
'Engine', |
1894
|
|
|
'Type', |
1895
|
|
|
'Version', |
1896
|
|
|
'Row_format', |
1897
|
|
|
'Rows', |
1898
|
|
|
'Avg_row_length', |
1899
|
|
|
'Data_length', |
1900
|
|
|
'Max_data_length', |
1901
|
|
|
'Index_length', |
1902
|
|
|
'Data_free', |
1903
|
|
|
'Auto_increment', |
1904
|
|
|
'Create_time', |
1905
|
|
|
'Update_time', |
1906
|
|
|
'Check_time', |
1907
|
|
|
'Collation', |
1908
|
|
|
'Checksum', |
1909
|
|
|
'Create_options', |
1910
|
|
|
'Comment', |
1911
|
|
|
], |
1912
|
|
|
'result' => [ |
1913
|
|
|
[ |
1914
|
|
|
'table1', |
1915
|
|
|
'DBIdummy', |
1916
|
|
|
'11', |
1917
|
|
|
'Redundant', |
1918
|
|
|
'123456', |
1919
|
|
|
'42', |
1920
|
|
|
'21708991', |
1921
|
|
|
'281474976710655',// MyISAM |
1922
|
|
|
'2048',// MyISAM |
1923
|
|
|
'2547', |
1924
|
|
|
'5', |
1925
|
|
|
'2014-06-24 17:30:00', |
1926
|
|
|
'2018-06-25 18:35:12', |
1927
|
|
|
'2015-04-24 19:30:59', |
1928
|
|
|
'utf8mb4_general_ci', |
1929
|
|
|
'3844432963', |
1930
|
|
|
'row_format=REDUNDANT', |
1931
|
|
|
'Test comment for "table1" in \'pma_test\'', |
1932
|
|
|
], |
1933
|
|
|
], |
1934
|
|
|
], |
1935
|
|
|
[ |
1936
|
|
|
'query' => 'SELECT *, CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME' |
1937
|
|
|
. ' FROM (SELECT BINARY s.SCHEMA_NAME AS BIN_NAME, s.DEFAULT_COLLATION_NAME' |
1938
|
|
|
. " FROM `information_schema`.SCHEMATA s WHERE `SCHEMA_NAME` LIKE 'pma_test'" |
1939
|
|
|
. ' GROUP BY BINARY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME ORDER BY' |
1940
|
|
|
. ' BINARY `SCHEMA_NAME` ASC) a', |
1941
|
|
|
'result' => [ |
1942
|
|
|
[ |
1943
|
|
|
'BIN_NAME' => 'pma_test', |
1944
|
|
|
'DEFAULT_COLLATION_NAME' => 'utf8mb4_general_ci', |
1945
|
|
|
'SCHEMA_NAME' => 'pma_test', |
1946
|
|
|
], |
1947
|
|
|
], |
1948
|
|
|
], |
1949
|
|
|
[ |
1950
|
|
|
'query' => 'SELECT *, CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME' |
1951
|
|
|
. ' FROM (SELECT BINARY s.SCHEMA_NAME AS BIN_NAME, s.DEFAULT_COLLATION_NAME' |
1952
|
|
|
. ' FROM `information_schema`.SCHEMATA s GROUP BY BINARY s.SCHEMA_NAME,' |
1953
|
|
|
. ' s.DEFAULT_COLLATION_NAME ORDER BY BINARY `SCHEMA_NAME` ASC) a', |
1954
|
|
|
'columns' => [ |
1955
|
|
|
'BIN_NAME', |
1956
|
|
|
'DEFAULT_COLLATION_NAME', |
1957
|
|
|
'SCHEMA_NAME', |
1958
|
|
|
], |
1959
|
|
|
'result' => [ |
1960
|
|
|
[ |
1961
|
|
|
'sakila', |
1962
|
|
|
'utf8_general_ci', |
1963
|
|
|
'sakila', |
1964
|
|
|
], |
1965
|
|
|
[ |
1966
|
|
|
'employees', |
1967
|
|
|
'latin1_swedish_ci', |
1968
|
|
|
'employees', |
1969
|
|
|
], |
1970
|
|
|
], |
1971
|
|
|
], |
1972
|
|
|
|
1973
|
|
|
[ |
1974
|
|
|
'query' => 'SELECT *, CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME' |
1975
|
|
|
. ' FROM (SELECT BINARY s.SCHEMA_NAME AS BIN_NAME, s.DEFAULT_COLLATION_NAME,' |
1976
|
|
|
. ' COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES, SUM(t.TABLE_ROWS) AS' |
1977
|
|
|
. ' SCHEMA_TABLE_ROWS, SUM(t.DATA_LENGTH) AS SCHEMA_DATA_LENGTH,' |
1978
|
|
|
. ' SUM(t.MAX_DATA_LENGTH) AS SCHEMA_MAX_DATA_LENGTH, SUM(t.INDEX_LENGTH)' |
1979
|
|
|
. ' AS SCHEMA_INDEX_LENGTH, SUM(t.DATA_LENGTH + t.INDEX_LENGTH) AS' |
1980
|
|
|
. " SCHEMA_LENGTH, SUM(IF(t.ENGINE <> 'InnoDB', t.DATA_FREE, 0)) AS" |
1981
|
|
|
. ' SCHEMA_DATA_FREE FROM `information_schema`.SCHEMATA s LEFT JOIN' |
1982
|
|
|
. ' `information_schema`.TABLES t ON BINARY t.TABLE_SCHEMA = BINARY' |
1983
|
|
|
. ' s.SCHEMA_NAME GROUP BY BINARY s.SCHEMA_NAME,' |
1984
|
|
|
. ' s.DEFAULT_COLLATION_NAME ORDER BY `SCHEMA_TABLES` DESC) a', |
1985
|
|
|
'columns' => [ |
1986
|
|
|
'BIN_NAME', |
1987
|
|
|
'DEFAULT_COLLATION_NAME', |
1988
|
|
|
'SCHEMA_TABLES', |
1989
|
|
|
'SCHEMA_TABLE_ROWS', |
1990
|
|
|
'SCHEMA_DATA_LENGTH', |
1991
|
|
|
'SCHEMA_INDEX_LENGTH', |
1992
|
|
|
'SCHEMA_LENGTH', |
1993
|
|
|
'SCHEMA_DATA_FREE', |
1994
|
|
|
'SCHEMA_NAME', |
1995
|
|
|
], |
1996
|
|
|
'result' => [ |
1997
|
|
|
[ |
1998
|
|
|
'sakila', |
1999
|
|
|
'utf8_general_ci', |
2000
|
|
|
'23', |
2001
|
|
|
'47274', |
2002
|
|
|
'4358144', |
2003
|
|
|
'2392064', |
2004
|
|
|
'6750208', |
2005
|
|
|
'0', |
2006
|
|
|
'sakila', |
2007
|
|
|
], |
2008
|
|
|
[ |
2009
|
|
|
'employees', |
2010
|
|
|
'latin1_swedish_ci', |
2011
|
|
|
'8', |
2012
|
|
|
'3912174', |
2013
|
|
|
'148111360', |
2014
|
|
|
'5816320', |
2015
|
|
|
'153927680', |
2016
|
|
|
'0', |
2017
|
|
|
'employees', |
2018
|
|
|
], |
2019
|
|
|
], |
2020
|
|
|
], |
2021
|
|
|
[ |
2022
|
|
|
'query' => 'SELECT @@have_partitioning;', |
2023
|
|
|
'result' => [], |
2024
|
|
|
], |
2025
|
|
|
[ |
2026
|
|
|
'query' => 'SELECT @@lower_case_table_names', |
2027
|
|
|
'result' => [], |
2028
|
|
|
], |
2029
|
|
|
[ |
2030
|
|
|
'query' => 'SELECT `PLUGIN_NAME`, `PLUGIN_DESCRIPTION` FROM `information_schema`.`PLUGINS`' |
2031
|
|
|
. ' WHERE `PLUGIN_TYPE` = \'AUTHENTICATION\';', |
2032
|
|
|
'columns' => ['PLUGIN_NAME', 'PLUGIN_DESCRIPTION'], |
2033
|
|
|
'result' => [ |
2034
|
|
|
['mysql_old_password', 'Old MySQL-4.0 authentication'], |
2035
|
|
|
['mysql_native_password', 'Native MySQL authentication'], |
2036
|
|
|
['sha256_password', 'SHA256 password authentication'], |
2037
|
|
|
['caching_sha2_password', 'Caching sha2 authentication'], |
2038
|
|
|
['auth_socket', 'Unix Socket based authentication'], |
2039
|
|
|
['unknown_auth_plugin', 'Unknown authentication'], |
2040
|
|
|
], |
2041
|
|
|
], |
2042
|
|
|
[ |
2043
|
|
|
'query' => 'SHOW TABLES FROM `db`;', |
2044
|
|
|
'result' => [], |
2045
|
|
|
], |
2046
|
|
|
[ |
2047
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM ' |
2048
|
|
|
. '`INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES` ' |
2049
|
|
|
. "WHERE GRANTEE='''pma_test''@''localhost''' " |
2050
|
|
|
. "AND PRIVILEGE_TYPE='EVENT' AND 'db' LIKE `TABLE_SCHEMA`", |
2051
|
|
|
'result' => [], |
2052
|
|
|
], |
2053
|
|
|
[ |
2054
|
|
|
'query' => 'SELECT `PRIVILEGE_TYPE` FROM ' |
2055
|
|
|
. '`INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES` ' |
2056
|
|
|
. "WHERE GRANTEE='''pma_test''@''localhost''' " |
2057
|
|
|
. "AND PRIVILEGE_TYPE='TRIGGER' AND 'db' LIKE `TABLE_SCHEMA`", |
2058
|
|
|
'result' => [], |
2059
|
|
|
], |
2060
|
|
|
[ |
2061
|
|
|
'query' => 'SELECT (COUNT(DB_first_level) DIV 100) * 100 from ' |
2062
|
|
|
. "( SELECT distinct SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) " |
2063
|
|
|
. 'DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA ' |
2064
|
|
|
. "WHERE `SCHEMA_NAME` < 'db' ) t", |
2065
|
|
|
'result' => [], |
2066
|
|
|
], |
2067
|
|
|
[ |
2068
|
|
|
'query' => 'SELECT (COUNT(DB_first_level) DIV 100) * 100 from ' |
2069
|
|
|
. "( SELECT distinct SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) " |
2070
|
|
|
. 'DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA ' |
2071
|
|
|
. "WHERE `SCHEMA_NAME` < 'pma_test' ) t", |
2072
|
|
|
'result' => [], |
2073
|
|
|
], |
2074
|
|
|
[ |
2075
|
|
|
'query' => 'SELECT `SCHEMA_NAME` FROM ' |
2076
|
|
|
. '`INFORMATION_SCHEMA`.`SCHEMATA`, ' |
2077
|
|
|
. '(SELECT DB_first_level FROM ( SELECT DISTINCT ' |
2078
|
|
|
. "SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM " |
2079
|
|
|
. 'INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t ' |
2080
|
|
|
. 'ORDER BY DB_first_level ASC LIMIT , 100) t2 WHERE TRUE AND ' |
2081
|
|
|
. "1 = LOCATE(CONCAT(DB_first_level, '_'), " |
2082
|
|
|
. "CONCAT(SCHEMA_NAME, '_')) ORDER BY SCHEMA_NAME ASC", |
2083
|
|
|
'result' => [], |
2084
|
|
|
], |
2085
|
|
|
[ |
2086
|
|
|
'query' => 'SELECT @@ndb_version_string', |
2087
|
|
|
'result' => [['ndb-7.4.10']], |
2088
|
|
|
], |
2089
|
|
|
[ |
2090
|
|
|
'query' => 'SELECT *, `COLUMN_NAME` AS `Field`, `COLUMN_TYPE` AS' |
2091
|
|
|
. ' `Type`, `COLLATION_NAME` AS `Collation`, `IS_NULLABLE` AS' |
2092
|
|
|
. ' `Null`, `COLUMN_KEY` AS `Key`, `COLUMN_DEFAULT` AS `Default`,' |
2093
|
|
|
. ' `EXTRA` AS `Extra`, `PRIVILEGES` AS `Privileges`,' |
2094
|
|
|
. ' `COLUMN_COMMENT` AS `Comment` FROM `information_schema`.`COLUMNS`' |
2095
|
|
|
. " WHERE `TABLE_SCHEMA` = 'information_schema' AND `TABLE_NAME` = 'PMA'", |
2096
|
|
|
'result' => [], |
2097
|
|
|
], |
2098
|
|
|
[ |
2099
|
|
|
'query' => 'SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME,' |
2100
|
|
|
. ' REFERENCED_COLUMN_NAME FROM information_schema.key_column_usage' |
2101
|
|
|
. " WHERE referenced_table_name IS NOT NULL AND TABLE_SCHEMA = 'test'" |
2102
|
|
|
. " AND TABLE_NAME IN ('table1','table2') AND" |
2103
|
|
|
. " REFERENCED_TABLE_NAME IN ('table1','table2');", |
2104
|
|
|
'result' => [ |
2105
|
|
|
[ |
2106
|
|
|
'TABLE_NAME' => 'table2', |
2107
|
|
|
'COLUMN_NAME' => 'idtable2', |
2108
|
|
|
'REFERENCED_TABLE_NAME' => 'table1', |
2109
|
|
|
'REFERENCED_COLUMN_NAME' => 'idtable1', |
2110
|
|
|
], |
2111
|
|
|
], |
2112
|
|
|
], |
2113
|
|
|
[ |
2114
|
|
|
'query' => 'SELECT `item_name`, `item_type` FROM `pmadb`.`navigationhiding`' |
2115
|
|
|
. " WHERE `username`='user' AND `db_name`='db' AND `table_name`=''", |
2116
|
|
|
'result' => [ |
2117
|
|
|
[ |
2118
|
|
|
'item_name' => 'tableName', |
2119
|
|
|
'item_type' => 'table', |
2120
|
|
|
], |
2121
|
|
|
[ |
2122
|
|
|
'item_name' => 'viewName', |
2123
|
|
|
'item_type' => 'view', |
2124
|
|
|
], |
2125
|
|
|
], |
2126
|
|
|
], |
2127
|
|
|
[ |
2128
|
|
|
'query' => 'SELECT `Table_priv` FROM `mysql`.`tables_priv` WHERE `User` =' |
2129
|
|
|
. ' \'PMA_username\' AND `Host` = \'PMA_hostname\' AND `Db` =' |
2130
|
|
|
. ' \'PMA_db\' AND `Table_name` = \'PMA_table\';', |
2131
|
|
|
'result' => [ |
2132
|
|
|
['Table_priv' => 'Select,Insert,Update,References,Create View,Show view'], |
2133
|
|
|
], |
2134
|
|
|
], |
2135
|
|
|
[ |
2136
|
|
|
'query' => 'SHOW COLUMNS FROM `my_db`.`test_tbl`', |
2137
|
|
|
'result' => [], |
2138
|
|
|
], |
2139
|
|
|
[ |
2140
|
|
|
'query' => 'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', |
2141
|
|
|
'result' => [ |
2142
|
|
|
['Type' => 'set(\'Select\',\'Insert\',\'Update\',\'References\',\'Create View\',\'Show view\')'], |
2143
|
|
|
], |
2144
|
|
|
], |
2145
|
|
|
[ |
2146
|
|
|
'query' => 'SHOW COLUMNS FROM `PMA_db`.`PMA_table`;', |
2147
|
|
|
'columns' => [ |
2148
|
|
|
'Field', |
2149
|
|
|
'Type', |
2150
|
|
|
'Null', |
2151
|
|
|
'Key', |
2152
|
|
|
'Default', |
2153
|
|
|
'Extra', |
2154
|
|
|
], |
2155
|
|
|
'result' => [ |
2156
|
|
|
[ |
2157
|
|
|
'id', |
2158
|
|
|
'int(11)', |
2159
|
|
|
'NO', |
2160
|
|
|
'PRI', |
2161
|
|
|
null, |
2162
|
|
|
'auto_increment', |
2163
|
|
|
], |
2164
|
|
|
[ |
2165
|
|
|
'name', |
2166
|
|
|
'varchar(20)', |
2167
|
|
|
'NO', |
2168
|
|
|
'', |
2169
|
|
|
null, |
2170
|
|
|
'', |
2171
|
|
|
], |
2172
|
|
|
[ |
2173
|
|
|
'datetimefield', |
2174
|
|
|
'datetime', |
2175
|
|
|
'NO', |
2176
|
|
|
'', |
2177
|
|
|
null, |
2178
|
|
|
'', |
2179
|
|
|
], |
2180
|
|
|
], |
2181
|
|
|
], |
2182
|
|
|
[ |
2183
|
|
|
'query' => 'SELECT `Column_name`, `Column_priv` FROM `mysql`.`columns_priv`' |
2184
|
|
|
. ' WHERE `User` = \'PMA_username\' AND `Host` = \'PMA_hostname\' AND' |
2185
|
|
|
. ' `Db` = \'PMA_db\' AND `Table_name` = \'PMA_table\';', |
2186
|
|
|
'columns' => [ |
2187
|
|
|
'Column_name', |
2188
|
|
|
'Column_priv', |
2189
|
|
|
], |
2190
|
|
|
'result' => [ |
2191
|
|
|
[ |
2192
|
|
|
'id', |
2193
|
|
|
'Select', |
2194
|
|
|
], |
2195
|
|
|
[ |
2196
|
|
|
'name', |
2197
|
|
|
'Select', |
2198
|
|
|
], |
2199
|
|
|
[ |
2200
|
|
|
'datetimefield', |
2201
|
|
|
'Select', |
2202
|
|
|
], |
2203
|
|
|
], |
2204
|
|
|
], |
2205
|
|
|
[ |
2206
|
|
|
'query' => 'SHOW GLOBAL STATUS', |
2207
|
|
|
'columns' => ['Variable_name', 'Value'], |
2208
|
|
|
'result' => [ |
2209
|
|
|
['Aborted_clients', '0'], |
2210
|
|
|
['Aborted_connects', '0'], |
2211
|
|
|
['Com_delete_multi', '0'], |
2212
|
|
|
['Com_create_function', '0'], |
2213
|
|
|
['Com_empty_query', '0'], |
2214
|
|
|
], |
2215
|
|
|
], |
2216
|
|
|
[ |
2217
|
|
|
'query' => 'SHOW GLOBAL VARIABLES', |
2218
|
|
|
'columns' => ['Variable_name', 'Value'], |
2219
|
|
|
'result' => [ |
2220
|
|
|
['auto_increment_increment', '1'], |
2221
|
|
|
['auto_increment_offset', '1'], |
2222
|
|
|
['automatic_sp_privileges', 'ON'], |
2223
|
|
|
['back_log', '50'], |
2224
|
|
|
['big_tables', 'OFF'], |
2225
|
|
|
['version', '8.0.2'], |
2226
|
|
|
], |
2227
|
|
|
], |
2228
|
|
|
[ |
2229
|
|
|
'query' => 'SELECT start_time, user_host, Sec_to_Time(Sum(Time_to_Sec(query_time))) ' |
2230
|
|
|
. 'as query_time, Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time,' |
2231
|
|
|
. ' SUM(rows_sent) AS rows_sent, SUM(rows_examined) AS rows_examined,' |
2232
|
|
|
. ' db, sql_text, COUNT(sql_text) AS \'#\' FROM `mysql`.`slow_log` WHERE' |
2233
|
|
|
. ' start_time > FROM_UNIXTIME(0) AND start_time < FROM_UNIXTIME(10) GROUP BY sql_text', |
2234
|
|
|
'columns' => ['sql_text', '#'], |
2235
|
|
|
'result' => [ |
2236
|
|
|
['insert sql_text', 11], |
2237
|
|
|
['update sql_text', 10], |
2238
|
|
|
], |
2239
|
|
|
], |
2240
|
|
|
[ |
2241
|
|
|
'query' => 'SELECT TIME(event_time) as event_time, user_host, thread_id,' |
2242
|
|
|
. ' server_id, argument, count(argument) as \'#\' FROM `mysql`.`general_log`' |
2243
|
|
|
. ' WHERE command_type=\'Query\' AND event_time > FROM_UNIXTIME(0)' |
2244
|
|
|
. ' AND event_time < FROM_UNIXTIME(10) AND argument REGEXP \'^(INSERT' |
2245
|
|
|
. '|SELECT|UPDATE|DELETE)\' GROUP by argument', |
2246
|
|
|
'columns' => ['sql_text', '#', 'argument'], |
2247
|
|
|
'result' => [ |
2248
|
|
|
['insert sql_text', 10, 'argument argument2'], |
2249
|
|
|
['update sql_text', 11, 'argument3 argument4'], |
2250
|
|
|
], |
2251
|
|
|
], |
2252
|
|
|
[ |
2253
|
|
|
'query' => 'SET PROFILING=1;', |
2254
|
|
|
'result' => [], |
2255
|
|
|
], |
2256
|
|
|
[ |
2257
|
|
|
'query' => 'query', |
2258
|
|
|
'result' => [], |
2259
|
|
|
], |
2260
|
|
|
[ |
2261
|
|
|
'query' => 'EXPLAIN query', |
2262
|
|
|
'columns' => ['sql_text', '#', 'argument'], |
2263
|
|
|
'result' => [ |
2264
|
|
|
['insert sql_text', 10, 'argument argument2'], |
2265
|
|
|
], |
2266
|
|
|
], |
2267
|
|
|
[ |
2268
|
|
|
'query' => 'SELECT seq,state,duration FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID=1 ORDER BY seq', |
2269
|
|
|
'result' => [], |
2270
|
|
|
], |
2271
|
|
|
[ |
2272
|
|
|
'query' => 'SHOW GLOBAL VARIABLES WHERE Variable_name IN ' |
2273
|
|
|
. '("general_log","slow_query_log","long_query_time","log_output")', |
2274
|
|
|
'columns' => ['Variable_name', 'Value'], |
2275
|
|
|
'result' => [ |
2276
|
|
|
['general_log', 'OFF'], |
2277
|
|
|
['log_output', 'FILE'], |
2278
|
|
|
['long_query_time', '10.000000'], |
2279
|
|
|
['slow_query_log', 'OFF'], |
2280
|
|
|
], |
2281
|
|
|
], |
2282
|
|
|
[ |
2283
|
|
|
'query' => 'INSERT INTO `db`.`table` (`username`, `export_type`, `template_name`, `template_data`)' |
2284
|
|
|
. ' VALUES (\'user\', \'type\', \'name\', \'data\');', |
2285
|
|
|
'result' => [], |
2286
|
|
|
], |
2287
|
|
|
[ |
2288
|
|
|
'query' => 'SELECT * FROM `db`.`table` WHERE `username` = \'user\'' |
2289
|
|
|
. ' AND `export_type` = \'type\' ORDER BY `template_name`;', |
2290
|
|
|
'columns' => ['id', 'username', 'export_type', 'template_name', 'template_data'], |
2291
|
|
|
'result' => [ |
2292
|
|
|
['1', 'user1', 'type1', 'name1', 'data1'], |
2293
|
|
|
['2', 'user2', 'type2', 'name2', 'data2'], |
2294
|
|
|
], |
2295
|
|
|
], |
2296
|
|
|
[ |
2297
|
|
|
'query' => 'DELETE FROM `db`.`table` WHERE `id` = 1 AND `username` = \'user\';', |
2298
|
|
|
'result' => [], |
2299
|
|
|
], |
2300
|
|
|
[ |
2301
|
|
|
'query' => 'SELECT * FROM `db`.`table` WHERE `id` = 1 AND `username` = \'user\';', |
2302
|
|
|
'columns' => ['id', 'username', 'export_type', 'template_name', 'template_data'], |
2303
|
|
|
'result' => [ |
2304
|
|
|
['1', 'user1', 'type1', 'name1', 'data1'], |
2305
|
|
|
], |
2306
|
|
|
], |
2307
|
|
|
[ |
2308
|
|
|
'query' => 'UPDATE `db`.`table` SET `template_data` = \'data\'' |
2309
|
|
|
. ' WHERE `id` = 1 AND `username` = \'user\';', |
2310
|
|
|
'result' => [], |
2311
|
|
|
], |
2312
|
|
|
[ |
2313
|
|
|
'query' => 'SHOW SLAVE HOSTS', |
2314
|
|
|
'columns' => ['Server_id', 'Host'], |
2315
|
|
|
'result' => [ |
2316
|
|
|
['Server_id1', 'Host1'], |
2317
|
|
|
['Server_id2', 'Host2'], |
2318
|
|
|
], |
2319
|
|
|
], |
2320
|
|
|
[ |
2321
|
|
|
'query' => 'SHOW ALL SLAVES STATUS', |
2322
|
|
|
'result' => [], |
2323
|
|
|
], |
2324
|
|
|
[ |
2325
|
|
|
'query' => 'SHOW COLUMNS FROM `mysql`.`user`', |
2326
|
|
|
'columns' => ['Field', 'Type', 'Null'], |
2327
|
|
|
'result' => [['host', 'char(60)', 'NO']], |
2328
|
|
|
], |
2329
|
|
|
[ |
2330
|
|
|
'query' => 'SHOW INDEXES FROM `mysql`.`user`', |
2331
|
|
|
'result' => [], |
2332
|
|
|
], |
2333
|
|
|
[ |
2334
|
|
|
'query' => 'SHOW INDEXES FROM `my_db`.`test_tbl`', |
2335
|
|
|
'result' => [], |
2336
|
|
|
], |
2337
|
|
|
[ |
2338
|
|
|
'query' => 'SELECT USER();', |
2339
|
|
|
'result' => [], |
2340
|
|
|
], |
2341
|
|
|
[ |
2342
|
|
|
'query' => 'SHOW PROCESSLIST', |
2343
|
|
|
'columns' => ['Id', 'User', 'Host', 'db', 'Command', 'Time', 'State', 'Info'], |
2344
|
|
|
'result' => [['Id1', 'User1', 'Host1', 'db1', 'Command1', 'Time1', 'State1', 'Info1']], |
2345
|
|
|
], |
2346
|
|
|
[ |
2347
|
|
|
'query' => 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` ORDER BY `Db` ASC', |
2348
|
|
|
'columns' => ['Id', 'User', 'Host', 'db', 'Command', 'Time', 'State', 'Info'], |
2349
|
|
|
'result' => [['Id1', 'User1', 'Host1', 'db1', 'Command1', 'Time1', 'State1', 'Info1']], |
2350
|
|
|
], |
2351
|
|
|
[ |
2352
|
|
|
'query' => 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` ORDER BY `Host` DESC', |
2353
|
|
|
'columns' => ['Id', 'User', 'Host', 'db', 'Command', 'Time', 'State', 'Info'], |
2354
|
|
|
'result' => [['Id1', 'User1', 'Host1', 'db1', 'Command1', 'Time1', 'State1', 'Info1']], |
2355
|
|
|
], |
2356
|
|
|
[ |
2357
|
|
|
'query' => 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` ORDER BY `process` DESC', |
2358
|
|
|
'columns' => ['Id', 'User', 'Host', 'db', 'Command', 'Time', 'State', 'Info'], |
2359
|
|
|
'result' => [['Id1', 'User1', 'Host1', 'db1', 'Command1', 'Time1', 'State1', 'Info1']], |
2360
|
|
|
], |
2361
|
|
|
[ |
2362
|
|
|
'query' => 'SELECT UNIX_TIMESTAMP() - 36000', |
2363
|
|
|
'result' => [], |
2364
|
|
|
], |
2365
|
|
|
[ |
2366
|
|
|
'query' => 'SELECT MAX(version) FROM `pmadb`.`tracking` WHERE `db_name` = \'db\'' |
2367
|
|
|
. ' AND `table_name` = \'hello_world\'', |
2368
|
|
|
'columns' => ['version'], |
2369
|
|
|
'result' => [['10']], |
2370
|
|
|
], |
2371
|
|
|
[ |
2372
|
|
|
'query' => 'SELECT MAX(version) FROM `pmadb`.`tracking` WHERE `db_name` = \'db\'' |
2373
|
|
|
. ' AND `table_name` = \'hello_lovely_world\'', |
2374
|
|
|
'columns' => ['version'], |
2375
|
|
|
'result' => [['10']], |
2376
|
|
|
], |
2377
|
|
|
[ |
2378
|
|
|
'query' => 'SELECT MAX(version) FROM `pmadb`.`tracking` WHERE `db_name` = \'db\'' |
2379
|
|
|
. ' AND `table_name` = \'hello_lovely_world2\'', |
2380
|
|
|
'columns' => ['version'], |
2381
|
|
|
'result' => [['10']], |
2382
|
|
|
], |
2383
|
|
|
[ |
2384
|
|
|
'query' => 'SELECT DISTINCT db_name, table_name FROM `pmadb`.`tracking`' |
2385
|
|
|
. ' WHERE db_name = \'PMA_db\' ORDER BY db_name, table_name', |
2386
|
|
|
'columns' => ['db_name', 'table_name', 'version'], |
2387
|
|
|
'result' => [['PMA_db', 'PMA_table', '10']], |
2388
|
|
|
], |
2389
|
|
|
[ |
2390
|
|
|
'query' => 'SELECT * FROM `pmadb`.`tracking` WHERE db_name = \'PMA_db\'' |
2391
|
|
|
. ' AND table_name = \'PMA_table\' ORDER BY version DESC', |
2392
|
|
|
'columns' => ['db_name', 'table_name', 'version', 'date_created', 'date_updated', 'tracking_active'], |
2393
|
|
|
'result' => [ |
2394
|
|
|
['PMA_db', 'PMA_table', '1', 'date_created', 'date_updated', '1'], |
2395
|
|
|
['PMA_db', 'PMA_table', '2', 'date_created', 'date_updated', '0'], |
2396
|
|
|
], |
2397
|
|
|
], |
2398
|
|
|
[ |
2399
|
|
|
'query' => 'SELECT tracking_active FROM `pmadb`.`tracking` WHERE db_name = \'PMA_db\'' |
2400
|
|
|
. ' AND table_name = \'PMA_table\' ORDER BY version DESC LIMIT 1', |
2401
|
|
|
'columns' => ['tracking_active'], |
2402
|
|
|
'result' => [['1']], |
2403
|
|
|
], |
2404
|
|
|
[ |
2405
|
|
|
'query' => 'SHOW TABLE STATUS FROM `PMA_db` WHERE `Name` LIKE \'PMA\\\\_table%\'', |
2406
|
|
|
'columns' => ['Name', 'Engine'], |
2407
|
|
|
'result' => [['PMA_table', 'InnoDB']], |
2408
|
|
|
], |
2409
|
|
|
[ |
2410
|
|
|
'query' => 'SELECT `id` FROM `table_1` WHERE `id` > 10 AND (`id` <> 20)', |
2411
|
|
|
'columns' => ['id'], |
2412
|
|
|
'result' => [['11'], ['12']], |
2413
|
|
|
], |
2414
|
|
|
[ |
2415
|
|
|
'query' => 'SELECT * FROM `table_1` WHERE `id` > 10', |
2416
|
|
|
'columns' => ['column'], |
2417
|
|
|
'result' => [['row1'], ['row2']], |
2418
|
|
|
], |
2419
|
|
|
[ |
2420
|
|
|
'query' => 'SELECT * FROM `PMA`.`table_1` LIMIT 1', |
2421
|
|
|
'columns' => ['column'], |
2422
|
|
|
'result' => [['table']], |
2423
|
|
|
], |
2424
|
|
|
[ |
2425
|
|
|
'query' => 'SELECT * FROM `PMA`.`table_2` LIMIT 1', |
2426
|
|
|
'columns' => ['column'], |
2427
|
|
|
'result' => [['table']], |
2428
|
|
|
], |
2429
|
|
|
[ |
2430
|
|
|
'query' => 'SELECT `ENGINE` FROM `information_schema`.`tables` WHERE `table_name` = "table_1"' |
2431
|
|
|
. ' AND `table_schema` = "PMA" AND UPPER(`engine`)' |
2432
|
|
|
. ' IN ("INNODB", "FALCON", "NDB", "INFINIDB", "TOKUDB", "XTRADB", "SEQUENCE", "BDB")', |
2433
|
|
|
'columns' => ['ENGINE'], |
2434
|
|
|
'result' => [['INNODB']], |
2435
|
|
|
], |
2436
|
|
|
[ |
2437
|
|
|
'query' => 'SELECT `ENGINE` FROM `information_schema`.`tables` WHERE `table_name` = "table_2"' |
2438
|
|
|
. ' AND `table_schema` = "PMA" AND UPPER(`engine`)' |
2439
|
|
|
. ' IN ("INNODB", "FALCON", "NDB", "INFINIDB", "TOKUDB", "XTRADB", "SEQUENCE", "BDB")', |
2440
|
|
|
'columns' => ['ENGINE'], |
2441
|
|
|
'result' => [['INNODB']], |
2442
|
|
|
], |
2443
|
|
|
[ |
2444
|
|
|
'query' => 'SHOW BINLOG EVENTS IN \'index1\' LIMIT 3, 10', |
2445
|
|
|
'columns' => ['Info', 'Log_name', 'Pos', 'Event_type', 'Orig_log_pos', 'End_log_pos', 'Server_id'], |
2446
|
|
|
'result' => [ |
2447
|
|
|
[ |
2448
|
|
|
'index1_Info', |
2449
|
|
|
'index1_Log_name', |
2450
|
|
|
'index1_Pos', |
2451
|
|
|
'index1_Event_type', |
2452
|
|
|
'index1_Orig_log_pos', |
2453
|
|
|
'index1_End_log_pos', |
2454
|
|
|
'index1_Server_id', |
2455
|
|
|
], |
2456
|
|
|
], |
2457
|
|
|
], |
2458
|
|
|
[ |
2459
|
|
|
'query' => 'SHOW FULL COLUMNS FROM `testdb`.`mytable` LIKE \'\\\\_id\'', |
2460
|
|
|
'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], |
2461
|
|
|
'result' => [ |
2462
|
|
|
[ |
2463
|
|
|
'_id', |
2464
|
|
|
'tinyint(4)', |
2465
|
|
|
null, |
2466
|
|
|
'NO', |
2467
|
|
|
'', |
2468
|
|
|
null, |
2469
|
|
|
'', |
2470
|
|
|
'select,insert,update,references', |
2471
|
|
|
'', |
2472
|
|
|
], |
2473
|
|
|
], |
2474
|
|
|
], |
2475
|
|
|
[ |
2476
|
|
|
'query' => 'SHOW FULL COLUMNS FROM `testdb`.`mytable`', |
2477
|
|
|
'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], |
2478
|
|
|
'result' => [ |
2479
|
|
|
[ |
2480
|
|
|
'aid', |
2481
|
|
|
'tinyint(4)', |
2482
|
|
|
null, |
2483
|
|
|
'NO', |
2484
|
|
|
'PRI', |
2485
|
|
|
null, |
2486
|
|
|
'', |
2487
|
|
|
'select,insert,update,references', |
2488
|
|
|
'', |
2489
|
|
|
], |
2490
|
|
|
[ |
2491
|
|
|
'_id', |
2492
|
|
|
'tinyint(4)', |
2493
|
|
|
null, |
2494
|
|
|
'NO', |
2495
|
|
|
'', |
2496
|
|
|
null, |
2497
|
|
|
'', |
2498
|
|
|
'select,insert,update,references', |
2499
|
|
|
'', |
2500
|
|
|
], |
2501
|
|
|
], |
2502
|
|
|
], |
2503
|
|
|
[ |
2504
|
|
|
'query' => 'SHOW INDEXES FROM `testdb`.`mytable`', |
2505
|
|
|
'result' => [], |
2506
|
|
|
], |
2507
|
|
|
[ |
2508
|
|
|
'query' => 'SHOW CREATE TABLE `testdb`.`mytable`', |
2509
|
|
|
'columns' => ['Table', 'Create Table'], |
2510
|
|
|
'result' => [ |
2511
|
|
|
[ |
2512
|
|
|
'test', |
2513
|
|
|
'CREATE TABLE `test` (' |
2514
|
|
|
. ' `aid` tinyint(4) NOT NULL,' |
2515
|
|
|
. ' `_id` tinyint(4) NOT NULL,' |
2516
|
|
|
. ' PRIMARY KEY (`aid`)' |
2517
|
|
|
. ') ENGINE=InnoDB DEFAULT CHARSET=latin1', |
2518
|
|
|
], |
2519
|
|
|
], |
2520
|
|
|
], |
2521
|
|
|
[ |
2522
|
|
|
'query' => 'SELECT * FROM `testdb`.`mytable` LIMIT 1', |
2523
|
|
|
'columns' => ['aid', '_id'], |
2524
|
|
|
'result' => [ |
2525
|
|
|
[ |
2526
|
|
|
1, |
2527
|
|
|
1, |
2528
|
|
|
], |
2529
|
|
|
], |
2530
|
|
|
], |
2531
|
|
|
[ |
2532
|
|
|
'query' => 'SHOW CREATE TABLE `test_db`.`test_table`', |
2533
|
|
|
'columns' => ['Table', 'Create Table'], |
2534
|
|
|
'result' => [['test_table', 'CREATE TABLE `test_table` (' . "\n" . ' `id` int(11) NOT NULL AUTO_INCREMENT,' . "\n" . ' `name` varchar(20) NOT NULL,' . "\n" . ' `datetimefield` datetime NOT NULL,' . "\n" . ' PRIMARY KEY (`id`)' . "\n" . ') ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4']], |
2535
|
|
|
], |
2536
|
|
|
[ |
2537
|
|
|
'query' => 'SHOW COLUMNS FROM `test_db`.`test_table`', |
2538
|
|
|
'columns' => ['Field', 'Type', 'Null', 'Key', 'Default', 'Extra'], |
2539
|
|
|
'result' => [ |
2540
|
|
|
['id', 'int(11)', 'NO', 'PRI', 'NULL', 'auto_increment'], |
2541
|
|
|
['name', 'varchar(20)', 'NO', '', 'NULL', ''], |
2542
|
|
|
['datetimefield', 'datetime', 'NO', '', 'NULL', ''], |
2543
|
|
|
], |
2544
|
|
|
], |
2545
|
|
|
[ |
2546
|
|
|
'query' => 'SHOW FULL COLUMNS FROM `test_db`.`test_table`', |
2547
|
|
|
'columns' => ['Field', 'Type', 'Null', 'Key', 'Default', 'Extra'], |
2548
|
|
|
'result' => [ |
2549
|
|
|
['id', 'int(11)', 'NO', 'PRI', 'NULL', 'auto_increment'], |
2550
|
|
|
['name', 'varchar(20)', 'NO', '', 'NULL', ''], |
2551
|
|
|
['datetimefield', 'datetime', 'NO', '', 'NULL', ''], |
2552
|
|
|
], |
2553
|
|
|
], |
2554
|
|
|
[ |
2555
|
|
|
'query' => 'DESC `test_db`.`test_table`', |
2556
|
|
|
'columns' => ['Field', 'Type', 'Null', 'Key', 'Default', 'Extra'], |
2557
|
|
|
'result' => [ |
2558
|
|
|
['id', 'int(11)', 'NO', 'PRI', 'NULL', 'auto_increment'], |
2559
|
|
|
['name', 'varchar(20)', 'NO', '', 'NULL', ''], |
2560
|
|
|
['datetimefield', 'datetime', 'NO', '', 'NULL', ''], |
2561
|
|
|
], |
2562
|
|
|
], |
2563
|
|
|
[ |
2564
|
|
|
'query' => 'SHOW TABLE STATUS FROM `test_db` WHERE `Name` LIKE \'test\\\\_table%\'', |
2565
|
|
|
'columns' => ['Name', 'Engine', 'Rows'], |
2566
|
|
|
'result' => [['test_table', 'InnoDB', '3']], |
2567
|
|
|
], |
2568
|
|
|
[ |
2569
|
|
|
'query' => 'SHOW TABLE STATUS FROM `test_db` WHERE Name = \'test_table\'', |
2570
|
|
|
'columns' => ['Name', 'Engine', 'Rows'], |
2571
|
|
|
'result' => [['test_table', 'InnoDB', '3']], |
2572
|
|
|
], |
2573
|
|
|
[ |
2574
|
|
|
'query' => 'SHOW INDEXES FROM `test_db`.`test_table`', |
2575
|
|
|
'columns' => ['Table', 'Non_unique', 'Key_name', 'Column_name'], |
2576
|
|
|
'result' => [['test_table', '0', 'PRIMARY', 'id']], |
2577
|
|
|
], |
2578
|
|
|
[ |
2579
|
|
|
'query' => 'SHOW INDEX FROM `test_table`;', |
2580
|
|
|
'columns' => ['Table', 'Non_unique', 'Key_name', 'Column_name'], |
2581
|
|
|
'result' => [['test_table', '0', 'PRIMARY', 'id']], |
2582
|
|
|
], |
2583
|
|
|
[ |
2584
|
|
|
'query' => 'SHOW TRIGGERS FROM `test_db` LIKE \'test_table\';', |
2585
|
|
|
'columns' => ['Trigger', 'Event', 'Table', 'Statement', 'Timing', 'Definer'], |
2586
|
|
|
'result' => [['test_trigger', 'INSERT', 'test_table', 'BEGIN END', 'AFTER', 'definer@localhost']], |
2587
|
|
|
], |
2588
|
|
|
[ |
2589
|
|
|
'query' => 'SELECT * FROM `test_db`.`test_table_yaml`;', |
2590
|
|
|
'columns' => ['id', 'name', 'datetimefield', 'textfield'], |
2591
|
|
|
'metadata' => [ |
2592
|
|
|
new FieldMetadata(MYSQLI_TYPE_DECIMAL, 0, (object) []), |
2593
|
|
|
new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) []), |
2594
|
|
|
new FieldMetadata(MYSQLI_TYPE_DATETIME, 0, (object) []), |
2595
|
|
|
new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) []), |
2596
|
|
|
], |
2597
|
|
|
'result' => [ |
2598
|
|
|
['1', 'abcd', '2011-01-20 02:00:02', null], |
2599
|
|
|
['2', 'foo', '2010-01-20 02:00:02', null], |
2600
|
|
|
['3', 'Abcd', '2012-01-20 02:00:02', null], |
2601
|
|
|
['4', 'Abcd', '2012-01-20 02:00:02', '123'], |
2602
|
|
|
['5', 'Abcd', '2012-01-20 02:00:02', '+30.2103210000'], |
2603
|
|
|
], |
2604
|
|
|
], |
2605
|
|
|
[ |
2606
|
|
|
'query' => 'SELECT * FROM `test_db`.`test_table`;', |
2607
|
|
|
'columns' => ['id', 'name', 'datetimefield'], |
2608
|
|
|
'result' => [ |
2609
|
|
|
['1', 'abcd', '2011-01-20 02:00:02'], |
2610
|
|
|
['2', 'foo', '2010-01-20 02:00:02'], |
2611
|
|
|
['3', 'Abcd', '2012-01-20 02:00:02'], |
2612
|
|
|
], |
2613
|
|
|
], |
2614
|
|
|
[ |
2615
|
|
|
'query' => 'SELECT * FROM `test_db`.`test_table_complex`;', |
2616
|
|
|
'columns' => ['f1', 'f2', 'f3', 'f4'], |
2617
|
|
|
'result' => [ |
2618
|
|
|
['"\'"><iframe onload=alert(1)>шеллы', '0x12346857fefe', "My awesome\nText", '0xaf1234f68c57fefe'], |
2619
|
|
|
[null, null, null, null], |
2620
|
|
|
['', '0x1', 'шеллы', '0x2'], |
2621
|
|
|
], |
2622
|
|
|
'metadata' => [ |
2623
|
|
|
new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) ['charsetnr' => 33]), |
2624
|
|
|
new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) ['charsetnr' => 63]), |
2625
|
|
|
new FieldMetadata(MYSQLI_TYPE_BLOB, 0, (object) ['charsetnr' => 23]), |
2626
|
|
|
new FieldMetadata(MYSQLI_TYPE_BLOB, 0, (object) ['charsetnr' => 63]), |
2627
|
|
|
], |
2628
|
|
|
], |
2629
|
|
|
[ |
2630
|
|
|
'query' => 'SHOW PROCEDURE STATUS;', |
2631
|
|
|
'columns' => ['Db', 'Name', 'Type'], |
2632
|
|
|
'result' => [ |
2633
|
|
|
['test_db', 'test_proc1', 'PROCEDURE'], |
2634
|
|
|
['test_db', 'test_proc2', 'PROCEDURE'], |
2635
|
|
|
], |
2636
|
|
|
], |
2637
|
|
|
[ |
2638
|
|
|
'query' => 'SHOW FUNCTION STATUS;', |
2639
|
|
|
'columns' => ['Db', 'Name', 'Type'], |
2640
|
|
|
'result' => [['test_db', 'test_func', 'FUNCTION']], |
2641
|
|
|
], |
2642
|
|
|
[ |
2643
|
|
|
'query' => 'SHOW CREATE PROCEDURE `test_db`.`test_proc1`', |
2644
|
|
|
'columns' => ['Procedure', 'Create Procedure'], |
2645
|
|
|
'result' => [['test_proc1', 'CREATE PROCEDURE `test_proc1` (p INT) BEGIN END']], |
2646
|
|
|
], |
2647
|
|
|
[ |
2648
|
|
|
'query' => 'SHOW CREATE PROCEDURE `test_db`.`test_proc2`', |
2649
|
|
|
'columns' => ['Procedure', 'Create Procedure'], |
2650
|
|
|
'result' => [['test_proc2', 'CREATE PROCEDURE `test_proc2` (p INT) BEGIN END']], |
2651
|
|
|
], |
2652
|
|
|
[ |
2653
|
|
|
'query' => 'SHOW CREATE FUNCTION `test_db`.`test_func`', |
2654
|
|
|
'columns' => ['Function', 'Create Function'], |
2655
|
|
|
'result' => [['test_func', 'CREATE FUNCTION `test_func` (p INT) RETURNS int(11) BEGIN END']], |
2656
|
|
|
], |
2657
|
|
|
[ |
2658
|
|
|
'query' => 'USE `test_db`', |
2659
|
|
|
'result' => [], |
2660
|
|
|
], |
2661
|
|
|
[ |
2662
|
|
|
'query' => 'SET SQL_QUOTE_SHOW_CREATE = 0', |
2663
|
|
|
'result' => [], |
2664
|
|
|
], |
2665
|
|
|
[ |
2666
|
|
|
'query' => 'SET SQL_QUOTE_SHOW_CREATE = 1', |
2667
|
|
|
'result' => [], |
2668
|
|
|
], |
2669
|
|
|
[ |
2670
|
|
|
'query' => 'UPDATE `test_tbl` SET `vc` = \'…zff s sf\' WHERE `test`.`ser` = 2', |
2671
|
|
|
'result' => [], |
2672
|
|
|
], |
2673
|
|
|
[ |
2674
|
|
|
'query' => 'UPDATE `test_tbl` SET `vc` = \'…ss s s\' WHERE `test`.`ser` = 1', |
2675
|
|
|
'result' => [], |
2676
|
|
|
], |
2677
|
|
|
[ |
2678
|
|
|
'query' => 'SELECT LAST_INSERT_ID();', |
2679
|
|
|
'result' => [], |
2680
|
|
|
], |
2681
|
|
|
[ |
2682
|
|
|
'query' => 'SHOW WARNINGS', |
2683
|
|
|
'result' => [], |
2684
|
|
|
], |
2685
|
|
|
[ |
2686
|
|
|
'query' => 'SELECT * FROM `information_schema`.`bookmark` WHERE dbase = \'my_db\'' |
2687
|
|
|
. ' AND (user = \'user\') AND `label` = \'test_tbl\' LIMIT 1', |
2688
|
|
|
'result' => [], |
2689
|
|
|
], |
2690
|
|
|
[ |
2691
|
|
|
'query' => 'SELECT `prefs` FROM `information_schema`.`table_uiprefs` WHERE `username` = \'user\'' |
2692
|
|
|
. ' AND `db_name` = \'my_db\' AND `table_name` = \'test_tbl\'', |
2693
|
|
|
'result' => [], |
2694
|
|
|
], |
2695
|
|
|
[ |
2696
|
|
|
'query' => 'SELECT DATABASE()', |
2697
|
|
|
'result' => [], |
2698
|
|
|
], |
2699
|
|
|
[ |
2700
|
|
|
'query' => 'SELECT * FROM `test_tbl` LIMIT 0, 25', |
2701
|
|
|
'columns' => ['vc', 'text', 'ser'], |
2702
|
|
|
'result' => [ |
2703
|
|
|
[ |
2704
|
|
|
'sss s s ', |
2705
|
|
|
'…z', |
2706
|
|
|
'1', |
2707
|
|
|
], |
2708
|
|
|
[ |
2709
|
|
|
'zzff s sf', |
2710
|
|
|
'…zff', |
2711
|
|
|
'2', |
2712
|
|
|
], |
2713
|
|
|
], |
2714
|
|
|
], |
2715
|
|
|
[ |
2716
|
|
|
'query' => 'SELECT @@have_profiling', |
2717
|
|
|
'result' => [], |
2718
|
|
|
], |
2719
|
|
|
[ |
2720
|
|
|
'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS' |
2721
|
|
|
. ' WHERE TABLE_SCHEMA = \'my_db\' AND TABLE_NAME = \'test_tbl\'', |
2722
|
|
|
'result' => [], |
2723
|
|
|
], |
2724
|
|
|
[ |
2725
|
|
|
'query' => 'SHOW FULL COLUMNS FROM `my_db`.`test_tbl`', |
2726
|
|
|
'result' => [], |
2727
|
|
|
], |
2728
|
|
|
[ |
2729
|
|
|
'query' => 'SHOW TABLE STATUS FROM `my_db` WHERE `Name` LIKE \'test\\\\_tbl%\'', |
2730
|
|
|
'result' => [], |
2731
|
|
|
], |
2732
|
|
|
[ |
2733
|
|
|
'query' => 'SHOW CREATE TABLE `my_db`.`test_tbl`', |
2734
|
|
|
'result' => [], |
2735
|
|
|
], |
2736
|
|
|
[ |
2737
|
|
|
'query' => 'SELECT COUNT(*) FROM `my_db`.`test_tbl`', |
2738
|
|
|
'result' => [], |
2739
|
|
|
], |
2740
|
|
|
[ |
2741
|
|
|
'query' => 'SELECT `master_field`, `foreign_db`, `foreign_table`, `foreign_field`' |
2742
|
|
|
. ' FROM `information_schema`.`relation`' |
2743
|
|
|
. ' WHERE `master_db` = \'my_db\' AND `master_table` = \'test_tbl\'', |
2744
|
|
|
'result' => [], |
2745
|
|
|
], |
2746
|
|
|
[ |
2747
|
|
|
'query' => 'SELECT `test_tbl`.`vc` FROM `my_db`.`test_tbl` WHERE `test`.`ser` = 2', |
2748
|
|
|
'result' => [], |
2749
|
|
|
], |
2750
|
|
|
[ |
2751
|
|
|
'query' => 'SELECT * FROM `pmadb`.`usergroups` ORDER BY `usergroup` ASC', |
2752
|
|
|
'columns' => ['usergroup', 'tab', 'allowed'], |
2753
|
|
|
'result' => [['usergroup', 'server_sql', 'Y']], |
2754
|
|
|
], |
2755
|
|
|
[ |
2756
|
|
|
'query' => 'DESCRIBE `test_table`', |
2757
|
|
|
'columns' => ['Field', 'Type', 'Null', 'Key', 'Default', 'Extra'], |
2758
|
|
|
'result' => [ |
2759
|
|
|
['id', 'int(11)', 'NO', 'PRI', 'NULL', 'auto_increment'], |
2760
|
|
|
['name', 'varchar(20)', 'NO', '', 'NULL', ''], |
2761
|
|
|
['datetimefield', 'datetime', 'NO', '', 'NULL', ''], |
2762
|
|
|
], |
2763
|
|
|
], |
2764
|
|
|
[ |
2765
|
|
|
'query' => 'SELECT * FROM `test_table` WHERE `id` = 4;', |
2766
|
|
|
'columns' => ['id', 'name', 'datetimefield'], |
2767
|
|
|
'result' => [['4', '101', '2013-01-20 02:00:02']], |
2768
|
|
|
], |
2769
|
|
|
[ |
2770
|
|
|
'query' => 'SELECT * FROM `mysql`.`user` WHERE `User` = \'username\' AND `Host` = \'hostname\';', |
2771
|
|
|
'columns' => ['Host', 'User', 'Password'], |
2772
|
|
|
'result' => [['hostname', 'username', 'password']], |
2773
|
|
|
], |
2774
|
|
|
[ |
2775
|
|
|
'query' => 'SELECT COUNT(*) FROM (SELECT * FROM company_users WHERE not_working_count != 0 ) as cnt', |
2776
|
|
|
'result' => false, |
2777
|
|
|
], |
2778
|
|
|
[ |
2779
|
|
|
'query' => 'SELECT COUNT(*) FROM (SELECT * FROM company_users ) as cnt', |
2780
|
|
|
'result' => [ |
2781
|
|
|
[4], |
2782
|
|
|
], |
2783
|
|
|
], |
2784
|
|
|
[ |
2785
|
|
|
'query' => 'SELECT COUNT(*) FROM (SELECT * FROM company_users WHERE working_count = 0 ) as cnt', |
2786
|
|
|
'result' => [ |
2787
|
|
|
[15], |
2788
|
|
|
], |
2789
|
|
|
], |
2790
|
|
|
[ |
2791
|
|
|
'query' => 'SELECT COUNT(*) FROM `my_dataset`.`company_users`', |
2792
|
|
|
'result' => [ |
2793
|
|
|
[18], |
2794
|
|
|
], |
2795
|
|
|
], |
2796
|
|
|
[ |
2797
|
|
|
'query' => 'SELECT COUNT(*) FROM (' |
2798
|
|
|
. 'SELECT *, 1, (SELECT COUNT(*) FROM tbl1) as c1, ' |
2799
|
|
|
. '(SELECT 1 FROM tbl2) as c2 FROM company_users WHERE subquery_case = 0 ) as cnt', |
2800
|
|
|
'result' => [ |
2801
|
|
|
[42], |
2802
|
|
|
], |
2803
|
|
|
], |
2804
|
|
|
[ |
2805
|
|
|
'query' => 'CREATE TABLE `event` SELECT DISTINCT `eventID`, `Start_time`,' |
2806
|
|
|
. ' `DateOfEvent`, `NumberOfGuests`, `NameOfVenue`, `LocationOfVenue` FROM `test_tbl`;', |
2807
|
|
|
'result' => [], |
2808
|
|
|
], |
2809
|
|
|
[ |
2810
|
|
|
'query' => 'ALTER TABLE `event` ADD PRIMARY KEY(`eventID`);', |
2811
|
|
|
'result' => [], |
2812
|
|
|
], |
2813
|
|
|
[ |
2814
|
|
|
'query' => 'CREATE TABLE `table2` SELECT DISTINCT `Start_time`,' |
2815
|
|
|
. ' `TypeOfEvent`, `period` FROM `test_tbl`;', |
2816
|
|
|
'result' => [], |
2817
|
|
|
], |
2818
|
|
|
[ |
2819
|
|
|
'query' => 'ALTER TABLE `table2` ADD PRIMARY KEY(`Start_time`);', |
2820
|
|
|
'result' => [], |
2821
|
|
|
], |
2822
|
|
|
[ |
2823
|
|
|
'query' => 'DROP TABLE `test_tbl`', |
2824
|
|
|
'result' => [], |
2825
|
|
|
], |
2826
|
|
|
[ |
2827
|
|
|
'query' => 'CREATE TABLE `batch_log2` SELECT DISTINCT `ID`, `task` FROM `test_tbl`;', |
2828
|
|
|
'result' => [], |
2829
|
|
|
], |
2830
|
|
|
[ |
2831
|
|
|
'query' => 'ALTER TABLE `batch_log2` ADD PRIMARY KEY(`ID`, `task`);', |
2832
|
|
|
'result' => [], |
2833
|
|
|
], |
2834
|
|
|
[ |
2835
|
|
|
'query' => 'CREATE TABLE `table2` SELECT DISTINCT `task`, `timestamp` FROM `test_tbl`;', |
2836
|
|
|
'result' => [], |
2837
|
|
|
], |
2838
|
|
|
[ |
2839
|
|
|
'query' => 'ALTER TABLE `table2` ADD PRIMARY KEY(`task`);', |
2840
|
|
|
'result' => [], |
2841
|
|
|
], |
2842
|
|
|
[ |
2843
|
|
|
'query' => 'CREATE DATABASE `test_db_error`;', |
2844
|
|
|
'result' => false, |
2845
|
|
|
], |
2846
|
|
|
[ |
2847
|
|
|
'query' => 'CREATE DATABASE `test_db` DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;', |
2848
|
|
|
'result' => [], |
2849
|
|
|
], |
2850
|
|
|
[ |
2851
|
|
|
'query' => 'SHOW TABLE STATUS FROM `test_db`', |
2852
|
|
|
'columns' => [ |
2853
|
|
|
'Name', |
2854
|
|
|
'Engine', |
2855
|
|
|
'Version', |
2856
|
|
|
'Row_format', |
2857
|
|
|
'Rows', |
2858
|
|
|
'Avg_row_length', |
2859
|
|
|
'Data_length', |
2860
|
|
|
'Max_data_length', |
2861
|
|
|
'Index_length', |
2862
|
|
|
'Data_free', |
2863
|
|
|
'Auto_increment', |
2864
|
|
|
'Create_time', |
2865
|
|
|
'Update_time', |
2866
|
|
|
'Check_time', |
2867
|
|
|
'Collation', |
2868
|
|
|
'Checksum', |
2869
|
|
|
'Create_options', |
2870
|
|
|
'Comment', |
2871
|
|
|
'Max_index_length', |
2872
|
|
|
'Temporary', |
2873
|
|
|
], |
2874
|
|
|
'result' => [ |
2875
|
|
|
[ |
2876
|
|
|
'test_table', |
2877
|
|
|
'InnoDB', |
2878
|
|
|
'10', |
2879
|
|
|
'Dynamic', |
2880
|
|
|
'3', |
2881
|
|
|
'5461', |
2882
|
|
|
'16384', |
2883
|
|
|
'0', |
2884
|
|
|
'0', |
2885
|
|
|
'0', |
2886
|
|
|
'4', |
2887
|
|
|
'2011-12-13 14:15:16', |
2888
|
|
|
null, |
2889
|
|
|
null, |
2890
|
|
|
'utf8mb4_general_ci', |
2891
|
|
|
null, |
2892
|
|
|
'', |
2893
|
|
|
'', |
2894
|
|
|
'0', |
2895
|
|
|
'N', |
2896
|
|
|
], |
2897
|
|
|
], |
2898
|
|
|
], |
2899
|
|
|
[ |
2900
|
|
|
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,' |
2901
|
|
|
. ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`, `ENGINE` AS `Type`,' |
2902
|
|
|
. ' `VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`,' |
2903
|
|
|
. ' `AVG_ROW_LENGTH` AS `Avg_row_length`, `DATA_LENGTH` AS `Data_length`,' |
2904
|
|
|
. ' `MAX_DATA_LENGTH` AS `Max_data_length`, `INDEX_LENGTH` AS `Index_length`,' |
2905
|
|
|
. ' `DATA_FREE` AS `Data_free`, `AUTO_INCREMENT` AS `Auto_increment`,' |
2906
|
|
|
. ' `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`,' |
2907
|
|
|
. ' `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`,' |
2908
|
|
|
. ' `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`,' |
2909
|
|
|
. ' `TABLE_COMMENT` AS `Comment` FROM `information_schema`.`TABLES` t' |
2910
|
|
|
. ' WHERE `TABLE_SCHEMA` IN (\'test_db\') ORDER BY Name ASC', |
2911
|
|
|
'columns' => [ |
2912
|
|
|
'TABLE_CATALOG', |
2913
|
|
|
'TABLE_SCHEMA', |
2914
|
|
|
'TABLE_NAME', |
2915
|
|
|
'TABLE_TYPE', |
2916
|
|
|
'ENGINE', |
2917
|
|
|
'VERSION', |
2918
|
|
|
'ROW_FORMAT', |
2919
|
|
|
'TABLE_ROWS', |
2920
|
|
|
'AVG_ROW_LENGTH', |
2921
|
|
|
'DATA_LENGTH', |
2922
|
|
|
'MAX_DATA_LENGTH', |
2923
|
|
|
'INDEX_LENGTH', |
2924
|
|
|
'DATA_FREE', |
2925
|
|
|
'AUTO_INCREMENT', |
2926
|
|
|
'CREATE_TIME', |
2927
|
|
|
'UPDATE_TIME', |
2928
|
|
|
'CHECK_TIME', |
2929
|
|
|
'TABLE_COLLATION', |
2930
|
|
|
'CHECKSUM', |
2931
|
|
|
'CREATE_OPTIONS', |
2932
|
|
|
'TABLE_COMMENT', |
2933
|
|
|
'MAX_INDEX_LENGTH', |
2934
|
|
|
'TEMPORARY', |
2935
|
|
|
'Db', |
2936
|
|
|
'Name', |
2937
|
|
|
'TABLE_TYPE', |
2938
|
|
|
'Engine', |
2939
|
|
|
'Type', |
2940
|
|
|
'Version', |
2941
|
|
|
'Row_format', |
2942
|
|
|
'Rows', |
2943
|
|
|
'Avg_row_length', |
2944
|
|
|
'Data_length', |
2945
|
|
|
'Max_data_length', |
2946
|
|
|
'Index_length', |
2947
|
|
|
'Data_free', |
2948
|
|
|
'Auto_increment', |
2949
|
|
|
'Create_time', |
2950
|
|
|
'Update_time', |
2951
|
|
|
'Check_time', |
2952
|
|
|
'Collation', |
2953
|
|
|
'Checksum', |
2954
|
|
|
'Create_options', |
2955
|
|
|
'Comment', |
2956
|
|
|
], |
2957
|
|
|
'result' => [ |
2958
|
|
|
[ |
2959
|
|
|
'def', |
2960
|
|
|
'test_db', |
2961
|
|
|
'test_table', |
2962
|
|
|
'BASE TABLE', |
2963
|
|
|
'InnoDB', |
2964
|
|
|
'10', |
2965
|
|
|
'Dynamic', |
2966
|
|
|
'3', |
2967
|
|
|
'5461', |
2968
|
|
|
'16384', |
2969
|
|
|
'0', |
2970
|
|
|
'0', |
2971
|
|
|
'0', |
2972
|
|
|
'4', |
2973
|
|
|
'2011-12-13 14:15:16', |
2974
|
|
|
null, |
2975
|
|
|
null, |
2976
|
|
|
'utf8mb4_general_ci', |
2977
|
|
|
null, |
2978
|
|
|
'', |
2979
|
|
|
'', |
2980
|
|
|
'0', |
2981
|
|
|
'N', |
2982
|
|
|
'test_db', |
2983
|
|
|
'test_table', |
2984
|
|
|
'BASE TABLE', |
2985
|
|
|
'InnoDB', |
2986
|
|
|
'InnoDB', |
2987
|
|
|
'10', |
2988
|
|
|
'Dynamic', |
2989
|
|
|
'3', |
2990
|
|
|
'5461', |
2991
|
|
|
'16384', |
2992
|
|
|
'0', |
2993
|
|
|
'0', |
2994
|
|
|
'0', |
2995
|
|
|
'4', |
2996
|
|
|
'2011-12-13 14:15:16', |
2997
|
|
|
null, |
2998
|
|
|
null, |
2999
|
|
|
'utf8mb4_general_ci', |
3000
|
|
|
null, |
3001
|
|
|
'', |
3002
|
|
|
'', |
3003
|
|
|
], |
3004
|
|
|
], |
3005
|
|
|
], |
3006
|
|
|
[ |
3007
|
|
|
'query' => 'SHOW TABLE STATUS FROM `world`', |
3008
|
|
|
'columns' => [ |
3009
|
|
|
'Name', |
3010
|
|
|
'Engine', |
3011
|
|
|
'Version', |
3012
|
|
|
'Row_format', |
3013
|
|
|
'Rows', |
3014
|
|
|
'Avg_row_length', |
3015
|
|
|
'Data_length', |
3016
|
|
|
'Max_data_length', |
3017
|
|
|
'Index_length', |
3018
|
|
|
'Data_free', |
3019
|
|
|
'Auto_increment', |
3020
|
|
|
'Create_time', |
3021
|
|
|
'Update_time', |
3022
|
|
|
'Check_time', |
3023
|
|
|
'Collation', |
3024
|
|
|
'Checksum', |
3025
|
|
|
'Create_options', |
3026
|
|
|
'Comment', |
3027
|
|
|
'Max_index_length', |
3028
|
|
|
'Temporary', |
3029
|
|
|
], |
3030
|
|
|
'result' => [ |
3031
|
|
|
[ |
3032
|
|
|
'City', |
3033
|
|
|
'InnoDB', |
3034
|
|
|
'10', |
3035
|
|
|
'Dynamic', |
3036
|
|
|
'4046', |
3037
|
|
|
'101', |
3038
|
|
|
'409600', |
3039
|
|
|
'0', |
3040
|
|
|
'114688', |
3041
|
|
|
'0', |
3042
|
|
|
'4080', |
3043
|
|
|
'2020-07-03 17:24:47', |
3044
|
|
|
null, |
3045
|
|
|
null, |
3046
|
|
|
'utf8mb4_general_ci', |
3047
|
|
|
null, |
3048
|
|
|
'', |
3049
|
|
|
'', |
3050
|
|
|
'0', |
3051
|
|
|
'N', |
3052
|
|
|
], |
3053
|
|
|
[ |
3054
|
|
|
'Country', |
3055
|
|
|
'InnoDB', |
3056
|
|
|
'10', |
3057
|
|
|
'Dynamic', |
3058
|
|
|
'239', |
3059
|
|
|
'479', |
3060
|
|
|
'114688', |
3061
|
|
|
'0', |
3062
|
|
|
'0', |
3063
|
|
|
'0', |
3064
|
|
|
null, |
3065
|
|
|
'2020-07-03 17:24:47', |
3066
|
|
|
null, |
3067
|
|
|
null, |
3068
|
|
|
'utf8mb4_general_ci', |
3069
|
|
|
null, |
3070
|
|
|
'', |
3071
|
|
|
'', |
3072
|
|
|
'0', |
3073
|
|
|
'N', |
3074
|
|
|
], |
3075
|
|
|
[ |
3076
|
|
|
'CountryLanguage', |
3077
|
|
|
'InnoDB', |
3078
|
|
|
'10', |
3079
|
|
|
'Dynamic', |
3080
|
|
|
'984', |
3081
|
|
|
'99', |
3082
|
|
|
'98304', |
3083
|
|
|
'0', |
3084
|
|
|
'65536', |
3085
|
|
|
'0', |
3086
|
|
|
null, |
3087
|
|
|
'2020-07-03 17:24:47', |
3088
|
|
|
null, |
3089
|
|
|
null, |
3090
|
|
|
'utf8mb4_general_ci', |
3091
|
|
|
null, |
3092
|
|
|
'', |
3093
|
|
|
'', |
3094
|
|
|
'0', |
3095
|
|
|
'N', |
3096
|
|
|
], |
3097
|
|
|
], |
3098
|
|
|
], |
3099
|
|
|
[ |
3100
|
|
|
'query' => 'SHOW TABLES FROM `world`;', |
3101
|
|
|
'columns' => ['Tables_in_world'], |
3102
|
|
|
'result' => [['City'], ['Country'], ['CountryLanguage']], |
3103
|
|
|
], |
3104
|
|
|
[ |
3105
|
|
|
'query' => 'SELECT COUNT(*) AS `row_count` FROM `world`.`City`', |
3106
|
|
|
'columns' => ['row_count'], |
3107
|
|
|
'result' => [['4079']], |
3108
|
|
|
], |
3109
|
|
|
[ |
3110
|
|
|
'query' => 'SELECT COUNT(*) AS `row_count` FROM `world`.`Country`', |
3111
|
|
|
'columns' => ['row_count'], |
3112
|
|
|
'result' => [['239']], |
3113
|
|
|
], |
3114
|
|
|
[ |
3115
|
|
|
'query' => 'SELECT COUNT(*) AS `row_count` FROM `world`.`CountryLanguage`', |
3116
|
|
|
'columns' => ['row_count'], |
3117
|
|
|
'result' => [['984']], |
3118
|
|
|
], |
3119
|
|
|
]; |
3120
|
|
|
|
3121
|
|
|
/* Some basic setup for dummy driver */ |
3122
|
|
|
$GLOBALS['cfg']['DBG']['sql'] = false; |
3123
|
|
|
} |
3124
|
|
|
} |
3125
|
|
|
|
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: