PageRenderTime 28ms 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

Large files files are truncated, but you can click here to view the full file

  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_Re…

Large files files are truncated, but you can click here to view the full file