PageRenderTime 54ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 1ms

/test/classes/Stubs/DbiDummy.php

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