Fix Display\ResultsTest test on Windows
[phpmyadmin.git] / test / classes / Stubs / DbiDummy.php
blob2279cbd04daa2428e060dcedb093cd076c33d16b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Fake database driver for testing purposes
6 * It has hardcoded results for given queries what makes easy to use it
7 * in testsuite. Feel free to include other queries which your test will
8 * need.
10 * @package PhpMyAdmin-DBI
11 * @subpackage Dummy
13 declare(strict_types=1);
15 namespace PhpMyAdmin\Tests\Stubs;
17 use PhpMyAdmin\Dbi\DbiExtension;
19 /**
20 * Fake database driver for testing purposes
22 * It has hardcoded results for given queries what makes easy to use it
23 * in testsuite. Feel free to include other queries which your test will
24 * need.
26 * @package PhpMyAdmin-DBI
27 * @subpackage Dummy
29 class DbiDummy implements DbiExtension
31 /**
32 * @var array
34 private $_queries = [];
36 /**
37 * @var int
39 public const OFFSET_GLOBAL = 1000;
41 /**
42 * DbiDummy constructor.
44 public function __construct()
46 $this->init();
49 /**
50 * connects to the database server
52 * @param string $user mysql user name
53 * @param string $password mysql user password
54 * @param array $server host/port/socket/persistent
56 * @return mixed false on error or a mysqli object on success
58 public function connect(
59 $user,
60 $password,
61 array $server = []
62 ) {
63 return true;
66 /**
67 * selects given database
69 * @param string $dbname name of db to select
70 * @param resource $link mysql link resource
72 * @return bool
74 public function selectDb($dbname, $link)
76 $GLOBALS['dummy_db'] = $dbname;
78 return true;
81 /**
82 * runs a query and returns the result
84 * @param string $query query to run
85 * @param resource $link mysql link resource
86 * @param int $options query options
88 * @return mixed
90 public function realQuery($query, $link = null, $options = 0)
92 $query = trim(preg_replace('/ */', ' ', str_replace("\n", ' ', $query)));
93 for ($i = 0, $nb = count($this->_queries); $i < $nb; $i++) {
94 if ($this->_queries[$i]['query'] != $query) {
95 continue;
98 $this->_queries[$i]['pos'] = 0;
99 if (! is_array($this->_queries[$i]['result'])) {
100 return false;
103 return $i;
105 for ($i = 0, $nb = count($GLOBALS['dummy_queries']); $i < $nb; $i++) {
106 if ($GLOBALS['dummy_queries'][$i]['query'] != $query) {
107 continue;
110 $GLOBALS['dummy_queries'][$i]['pos'] = 0;
111 if (! is_array($GLOBALS['dummy_queries'][$i]['result'])) {
112 return false;
115 return $i + self::OFFSET_GLOBAL;
117 echo "Not supported query: $query\n";
119 return false;
123 * Run the multi query and output the results
125 * @param resource $link connection object
126 * @param string $query multi query statement to execute
128 * @return array|bool
130 public function realMultiQuery($link, $query)
132 return false;
136 * returns result data from $result
138 * @param object $result MySQL result
140 * @return array|bool
142 public function fetchAny($result)
144 $query_data = &$this->getQueryData($result);
145 if ($query_data['pos'] >= count((array) $query_data['result'])) {
146 return false;
148 $ret = $query_data['result'][$query_data['pos']];
149 $query_data['pos'] += 1;
151 return $ret;
155 * returns array of rows with associative and numeric keys from $result
157 * @param object $result result MySQL result
159 * @return array
161 public function fetchArray($result)
163 $query_data = &$this->getQueryData($result);
164 $data = $this->fetchAny($result);
165 if (! is_array($data)
166 || ! isset($query_data['columns'])
168 return $data;
171 foreach ($data as $key => $val) {
172 $data[$query_data['columns'][$key]] = $val;
175 return $data;
179 * returns array of rows with associative keys from $result
181 * @param object $result MySQL result
183 * @return array
185 public function fetchAssoc($result)
187 $data = $this->fetchAny($result);
188 $query_data = &$this->getQueryData($result);
189 if (! is_array($data) || ! isset($query_data['columns'])) {
190 return $data;
193 $ret = [];
194 foreach ($data as $key => $val) {
195 $ret[$query_data['columns'][$key]] = $val;
198 return $ret;
202 * returns array of rows with numeric keys from $result
204 * @param object $result MySQL result
206 * @return array
208 public function fetchRow($result)
210 return $this->fetchAny($result);
214 * Adjusts the result pointer to an arbitrary row in the result
216 * @param object $result database result
217 * @param integer $offset offset to seek
219 * @return bool true on success, false on failure
221 public function dataSeek($result, $offset)
223 $query_data = &$this->getQueryData($result);
224 if ($offset > count($query_data['result'])) {
225 return false;
227 $query_data['pos'] = $offset;
229 return true;
233 * Frees memory associated with the result
235 * @param object $result database result
237 * @return void
239 public function freeResult($result)
241 return;
245 * Check if there are any more query results from a multi query
247 * @param resource $link the connection object
249 * @return bool false
251 public function moreResults($link)
253 return false;
257 * Prepare next result from multi_query
259 * @param resource $link the connection object
261 * @return boolean false
263 public function nextResult($link)
265 return false;
269 * Store the result returned from multi query
271 * @param resource $link the connection object
273 * @return mixed false when empty results / result set when not empty
275 public function storeResult($link)
277 return false;
281 * Returns a string representing the type of connection used
283 * @param resource $link mysql link
285 * @return string type of connection used
287 public function getHostInfo($link)
289 return '';
293 * Returns the version of the MySQL protocol used
295 * @param resource $link mysql link
297 * @return integer version of the MySQL protocol used
299 public function getProtoInfo($link)
301 return -1;
305 * returns a string that represents the client library version
307 * @param resource $link connection link
309 * @return string MySQL client library version
311 public function getClientInfo($link)
313 return '';
317 * returns last error message or false if no errors occurred
319 * @param resource $link connection link
321 * @return string|bool error or false
323 public function getError($link)
325 return false;
329 * returns the number of rows returned by last query
331 * @param object $result MySQL result
333 * @return string|int
335 public function numRows($result)
337 if (is_bool($result)) {
338 return 0;
341 $query_data = &$this->getQueryData($result);
343 return count($query_data['result']);
347 * returns the number of rows affected by last query
349 * @param resource $link the mysql object
350 * @param bool $get_from_cache whether to retrieve from cache
352 * @return string|int
354 public function affectedRows($link = null, $get_from_cache = true)
356 return 0;
360 * returns metainfo for fields in $result
362 * @param object $result result set identifier
364 * @return array meta info for fields in $result
366 public function getFieldsMeta($result)
368 return [];
372 * return number of fields in given $result
374 * @param object $result MySQL result
376 * @return int field count
378 public function numFields($result)
380 $query_data = &$this->getQueryData($result);
381 if (! isset($query_data['columns'])) {
382 return 0;
385 return count($query_data['columns']);
389 * returns the length of the given field $i in $result
391 * @param object $result result set identifier
392 * @param int $i field
394 * @return int length of field
396 public function fieldLen($result, $i)
398 return -1;
402 * returns name of $i. field in $result
404 * @param object $result result set identifier
405 * @param int $i field
407 * @return string name of $i. field in $result
409 public function fieldName($result, $i)
411 return '';
415 * returns concatenated string of human readable field flags
417 * @param object $result result set identifier
418 * @param int $i field
420 * @return string field flags
422 public function fieldFlags($result, $i)
424 return '';
428 * returns properly escaped string for use in MySQL queries
430 * @param mixed $link database link
431 * @param string $str string to be escaped
433 * @return string a MySQL escaped string
435 public function escapeString($link, $str)
437 return addslashes($str);
441 * Adds query result for testing
443 * @param string $query SQL
444 * @param array $result Expected result
446 * @return void
448 public function setResult($query, $result)
450 $this->_queries[] = [
451 'query' => $query,
452 'result' => $result,
457 * Return query data for ID
459 * @param object $result result set identifier
461 * @return array
463 private function &getQueryData($result)
465 if ($result >= self::OFFSET_GLOBAL) {
466 return $GLOBALS['dummy_queries'][$result - self::OFFSET_GLOBAL];
467 } else {
468 return $this->_queries[$result];
473 * @return void
475 private function init(): void
478 * Array of queries this "driver" supports
480 $GLOBALS['dummy_queries'] = [
482 'query' => 'SELECT 1',
483 'result' => [['1']],
486 'query' => 'SELECT CURRENT_USER();',
487 'result' => [['pma_test@localhost']],
490 'query' => "SHOW VARIABLES LIKE 'lower_case_table_names'",
491 'result' => [
493 'lower_case_table_names',
494 '1',
499 'query' => 'SELECT 1 FROM mysql.user LIMIT 1',
500 'result' => [['1']],
503 'query' => "SELECT 1 FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES`"
504 . " WHERE `PRIVILEGE_TYPE` = 'CREATE USER'"
505 . " AND '''pma_test''@''localhost''' LIKE `GRANTEE` LIMIT 1",
506 'result' => [['1']],
509 'query' => "SELECT 1 FROM (SELECT `GRANTEE`, `IS_GRANTABLE`"
510 . " FROM `INFORMATION_SCHEMA`.`COLUMN_PRIVILEGES`"
511 . " UNION SELECT `GRANTEE`, `IS_GRANTABLE`"
512 . " FROM `INFORMATION_SCHEMA`.`TABLE_PRIVILEGES`"
513 . " UNION SELECT `GRANTEE`, `IS_GRANTABLE`"
514 . " FROM `INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES`"
515 . " UNION SELECT `GRANTEE`, `IS_GRANTABLE`"
516 . " FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES`) t"
517 . " WHERE `IS_GRANTABLE` = 'YES'"
518 . " AND '''pma_test''@''localhost''' LIKE `GRANTEE` LIMIT 1",
519 'result' => [['1']],
522 'query' => 'SHOW MASTER LOGS',
523 'result' => false,
526 'query' => 'SHOW STORAGE ENGINES',
527 'result' => [
529 'Engine' => 'dummy',
530 'Support' => 'YES',
531 'Comment' => 'dummy comment',
534 'Engine' => 'dummy2',
535 'Support' => 'NO',
536 'Comment' => 'dummy2 comment',
539 'Engine' => 'FEDERATED',
540 'Support' => 'NO',
541 'Comment' => 'Federated MySQL storage engine',
544 'Engine' => 'Pbxt',
545 'Support' => 'NO',
546 'Comment' => 'Pbxt storage engine',
551 'query' => 'SHOW STATUS WHERE Variable_name'
552 . ' LIKE \'Innodb\\_buffer\\_pool\\_%\''
553 . ' OR Variable_name = \'Innodb_page_size\';',
554 'result' => [
556 'Innodb_buffer_pool_pages_data',
560 'Innodb_buffer_pool_pages_dirty',
564 'Innodb_buffer_pool_pages_flushed',
568 'Innodb_buffer_pool_pages_free',
572 'Innodb_buffer_pool_pages_misc',
576 'Innodb_buffer_pool_pages_total',
577 4096,
580 'Innodb_buffer_pool_read_ahead_rnd',
584 'Innodb_buffer_pool_read_ahead',
588 'Innodb_buffer_pool_read_ahead_evicted',
592 'Innodb_buffer_pool_read_requests',
596 'Innodb_buffer_pool_reads',
600 'Innodb_buffer_pool_wait_free',
604 'Innodb_buffer_pool_write_requests',
608 'Innodb_page_size',
609 16384,
614 'query' => 'SHOW ENGINE INNODB STATUS;',
615 'result' => false,
618 'query' => 'SELECT @@innodb_version;',
619 'result' => [
620 ['1.1.8'],
624 'query' => 'SELECT @@disabled_storage_engines',
625 'result' => [
626 [''],
630 'query' => 'SHOW GLOBAL VARIABLES LIKE \'innodb_file_per_table\';',
631 'result' => [
633 'innodb_file_per_table',
634 'OFF',
639 'query' => 'SHOW GLOBAL VARIABLES LIKE \'innodb_file_format\';',
640 'result' => [
642 'innodb_file_format',
643 'Antelope',
648 'query' => 'SELECT @@collation_server',
649 'result' => [
650 ['utf8_general_ci'],
654 'query' => 'SELECT @@lc_messages;',
655 'result' => [],
658 'query' => 'SHOW SESSION VARIABLES LIKE \'FOREIGN_KEY_CHECKS\';',
659 'result' => [
661 'foreign_key_checks',
662 'ON',
667 'query' => 'SHOW TABLES FROM `pma_test`;',
668 'result' => [
669 ['table1'],
670 ['table2'],
674 'query' => 'SHOW TABLES FROM `pmadb`',
675 'result' => [
676 ['column_info'],
680 'query' => 'SHOW COLUMNS FROM `pma_test`.`table1`',
681 'columns' => [
682 'Field',
683 'Type',
684 'Null',
685 'Key',
686 'Default',
687 'Extra',
689 'result' => [
691 'i',
692 'int(11)',
693 'NO',
694 'PRI',
695 'NULL',
696 'auto_increment',
699 'o',
700 'int(11)',
701 'NO',
702 'MUL',
703 'NULL',
709 'query' => 'SHOW INDEXES FROM `pma_test`.`table1` WHERE (Non_unique = 0)',
710 'result' => [],
713 'query' => 'SHOW COLUMNS FROM `pma_test`.`table2`',
714 'columns' => [
715 'Field',
716 'Type',
717 'Null',
718 'Key',
719 'Default',
720 'Extra',
722 'result' => [
724 'i',
725 'int(11)',
726 'NO',
727 'PRI',
728 'NULL',
729 'auto_increment',
732 'o',
733 'int(11)',
734 'NO',
735 'MUL',
736 'NULL',
742 'query' => 'SHOW INDEXES FROM `pma_test`.`table1`',
743 'result' => [],
746 'query' => 'SHOW INDEXES FROM `pma_test`.`table2`',
747 'result' => [],
750 'query' => 'SHOW COLUMNS FROM `pma`.`table1`',
751 'columns' => [
752 'Field',
753 'Type',
754 'Null',
755 'Key',
756 'Default',
757 'Extra',
758 'Privileges',
759 'Comment',
761 'result' => [
763 'i',
764 'int(11)',
765 'NO',
766 'PRI',
767 'NULL',
768 'auto_increment',
769 'select,insert,update,references',
773 'o',
774 'varchar(100)',
775 'NO',
776 'MUL',
777 'NULL',
779 'select,insert,update,references',
785 'query' => 'SELECT `CHARACTER_SET_NAME` AS `Charset`,'
786 . ' `DEFAULT_COLLATE_NAME` AS `Default collation`,'
787 . ' `DESCRIPTION` AS `Description`,'
788 . ' `MAXLEN` AS `Maxlen`'
789 . ' FROM `information_schema`.`CHARACTER_SETS`',
790 'columns' => [
791 'Charset',
792 'Default collation',
793 'Description',
794 'Maxlen',
796 'result' => [
798 'utf8',
799 'utf8_general_ci',
800 'UTF-8 Unicode',
801 '3',
804 'latin1',
805 'latin1_swedish_ci',
806 'cp1252 West European',
807 '1',
812 'query' => 'SELECT `COLLATION_NAME` AS `Collation`,'
813 . ' `CHARACTER_SET_NAME` AS `Charset`,'
814 . ' `ID` AS `Id`,'
815 . ' `IS_DEFAULT` AS `Default`,'
816 . ' `IS_COMPILED` AS `Compiled`,'
817 . ' `SORTLEN` AS `Sortlen`'
818 . ' FROM `information_schema`.`COLLATIONS`',
819 'columns' => [
820 'Collation',
821 'Charset',
822 'Id',
823 'Default',
824 'Compiled',
825 'Sortlen',
827 'result' => [
829 'utf8_general_ci',
830 'utf8',
831 '33',
832 'Yes',
833 'Yes',
834 '1',
837 'utf8_bin',
838 'utf8',
839 '83',
841 'Yes',
842 '1',
845 'latin1_swedish_ci',
846 'latin1',
847 '8',
848 'Yes',
849 'Yes',
850 '1',
855 'query' => 'SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`TABLES`'
856 . ' WHERE `TABLE_SCHEMA`=\'pma_test\' AND `TABLE_TYPE` IN (\'BASE TABLE\', \'SYSTEM VERSIONED\')',
857 'result' => [],
860 'query' => 'SELECT `column_name`, `mimetype`, `transformation`,'
861 . ' `transformation_options`, `input_transformation`,'
862 . ' `input_transformation_options`'
863 . ' FROM `pmadb`.`column_info`'
864 . ' WHERE `db_name` = \'pma_test\' AND `table_name` = \'table1\''
865 . ' AND ( `mimetype` != \'\' OR `transformation` != \'\''
866 . ' OR `transformation_options` != \'\''
867 . ' OR `input_transformation` != \'\''
868 . ' OR `input_transformation_options` != \'\')',
869 'columns' => [
870 'column_name',
871 'mimetype',
872 'transformation',
873 'transformation_options',
874 'input_transformation',
875 'input_transformation_options',
877 'result' => [
879 'o',
880 'text/plain',
881 'sql',
883 'regex',
884 '/pma/i',
887 'col',
888 't',
889 'o/p',
891 'i/p',
897 'query' => 'SELECT TABLE_NAME FROM information_schema.VIEWS'
898 . ' WHERE TABLE_SCHEMA = \'pma_test\' AND TABLE_NAME = \'table1\'',
899 'result' => [],
902 'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,'
903 . ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,'
904 . ' `ENGINE` AS `Type`, `VERSION` AS `Version`,'
905 . ' `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`,'
906 . ' `AVG_ROW_LENGTH` AS `Avg_row_length`,'
907 . ' `DATA_LENGTH` AS `Data_length`,'
908 . ' `MAX_DATA_LENGTH` AS `Max_data_length`,'
909 . ' `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,'
910 . ' `AUTO_INCREMENT` AS `Auto_increment`,'
911 . ' `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`,'
912 . ' `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`,'
913 . ' `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`,'
914 . ' `TABLE_COMMENT` AS `Comment`'
915 . ' FROM `information_schema`.`TABLES` t'
916 . ' WHERE `TABLE_SCHEMA` IN (\'pma_test\')'
917 . ' AND t.`TABLE_NAME` = \'table1\' ORDER BY Name ASC',
918 'columns' => [
919 'TABLE_CATALOG',
920 'TABLE_SCHEMA',
921 'TABLE_NAME',
922 'TABLE_TYPE',
923 'ENGINE',
924 'VERSION',
925 'ROW_FORMAT',
926 'TABLE_ROWS',
927 'AVG_ROW_LENGTH',
928 'DATA_LENGTH',
929 'MAX_DATA_LENGTH',
930 'INDEX_LENGTH',
931 'DATA_FREE',
932 'AUTO_INCREMENT',
933 'CREATE_TIME',
934 'UPDATE_TIME',
935 'CHECK_TIME',
936 'TABLE_COLLATION',
937 'CHECKSUM',
938 'CREATE_OPTIONS',
939 'TABLE_COMMENT',
940 'Db',
941 'Name',
942 'TABLE_TYPE',
943 'Engine',
944 'Type',
945 'Version',
946 'Row_format',
947 'Rows',
948 'Avg_row_length',
949 'Data_length',
950 'Max_data_length',
951 'Index_length',
952 'Data_free',
953 'Auto_increment',
954 'Create_time',
955 'Update_time',
956 'Check_time',
957 'Collation',
958 'Checksum',
959 'Create_options',
960 'Comment',
962 'result' => [
964 'def',
965 'smash',
966 'issues_issue',
967 'BASE TABLE',
968 'InnoDB',
969 '10',
970 'Compact',
971 '9136',
972 '862',
973 '7880704',
974 '0',
975 '1032192',
976 '420478976',
977 '155862',
978 '2012-08-29 13:28:28',
979 'NULL',
980 'NULL',
981 'utf8_general_ci',
982 'NULL',
985 'smash',
986 'issues_issue',
987 'BASE TABLE',
988 'InnoDB',
989 'InnoDB',
990 '10',
991 'Compact',
992 '9136',
993 '862',
994 '7880704',
995 '0',
996 '1032192',
997 '420478976',
998 '155862',
999 '2012-08-29 13:28:28',
1000 'NULL',
1001 'NULL',
1002 'utf8_general_ci',
1003 'NULL',
1008 'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,'
1009 . ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,'
1010 . ' `ENGINE` AS `Type`, `VERSION` AS `Version`,'
1011 . ' `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`,'
1012 . ' `AVG_ROW_LENGTH` AS `Avg_row_length`,'
1013 . ' `DATA_LENGTH` AS `Data_length`,'
1014 . ' `MAX_DATA_LENGTH` AS `Max_data_length`,'
1015 . ' `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,'
1016 . ' `AUTO_INCREMENT` AS `Auto_increment`,'
1017 . ' `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`,'
1018 . ' `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`,'
1019 . ' `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`,'
1020 . ' `TABLE_COMMENT` AS `Comment`'
1021 . ' FROM `information_schema`.`TABLES` t'
1022 . ' WHERE `TABLE_SCHEMA` IN (\'pma_test\')'
1023 . ' AND t.`TABLE_NAME` = \'table1\' ORDER BY Name ASC',
1024 'columns' => [
1025 'TABLE_CATALOG',
1026 'TABLE_SCHEMA',
1027 'TABLE_NAME',
1028 'TABLE_TYPE',
1029 'ENGINE',
1030 'VERSION',
1031 'ROW_FORMAT',
1032 'TABLE_ROWS',
1033 'AVG_ROW_LENGTH',
1034 'DATA_LENGTH',
1035 'MAX_DATA_LENGTH',
1036 'INDEX_LENGTH',
1037 'DATA_FREE',
1038 'AUTO_INCREMENT',
1039 'CREATE_TIME',
1040 'UPDATE_TIME',
1041 'CHECK_TIME',
1042 'TABLE_COLLATION',
1043 'CHECKSUM',
1044 'CREATE_OPTIONS',
1045 'TABLE_COMMENT',
1046 'Db',
1047 'Name',
1048 'TABLE_TYPE',
1049 'Engine',
1050 'Type',
1051 'Version',
1052 'Row_format',
1053 'Rows',
1054 'Avg_row_length',
1055 'Data_length',
1056 'Max_data_length',
1057 'Index_length',
1058 'Data_free',
1059 'Auto_increment',
1060 'Create_time',
1061 'Update_time',
1062 'Check_time',
1063 'Collation',
1064 'Checksum',
1065 'Create_options',
1066 'Comment',
1068 'result' => [
1070 'def',
1071 'smash',
1072 'issues_issue',
1073 'BASE TABLE',
1074 'InnoDB',
1075 '10',
1076 'Compact',
1077 '9136',
1078 '862',
1079 '7880704',
1080 '0',
1081 '1032192',
1082 '420478976',
1083 '155862',
1084 '2012-08-29 13:28:28',
1085 'NULL',
1086 'NULL',
1087 'utf8_general_ci',
1088 'NULL',
1091 'smash',
1092 'issues_issue',
1093 'BASE TABLE',
1094 'InnoDB',
1095 'InnoDB',
1096 '10',
1097 'Compact',
1098 '9136',
1099 '862',
1100 '7880704',
1101 '0',
1102 '1032192',
1103 '420478976',
1104 '155862',
1105 '2012-08-29 13:28:28',
1106 'NULL',
1107 'NULL',
1108 'utf8_general_ci',
1109 'NULL',
1114 'query' => 'SELECT COUNT(*) FROM `pma_test`.`table1`',
1115 'result' => [[0]],
1118 'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
1119 . '`USER_PRIVILEGES`'
1120 . ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
1121 . ' AND PRIVILEGE_TYPE=\'TRIGGER\'',
1122 'result' => [],
1125 'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
1126 . '`SCHEMA_PRIVILEGES`'
1127 . ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
1128 . ' AND PRIVILEGE_TYPE=\'TRIGGER\' AND \'pma_test\''
1129 . ' LIKE `TABLE_SCHEMA`',
1130 'result' => [],
1133 'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
1134 . '`TABLE_PRIVILEGES`'
1135 . ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
1136 . ' AND PRIVILEGE_TYPE=\'TRIGGER\' AND \'pma_test\''
1137 . ' LIKE `TABLE_SCHEMA` AND TABLE_NAME=\'table1\'',
1138 'result' => [],
1141 'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
1142 . '`USER_PRIVILEGES`'
1143 . ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
1144 . ' AND PRIVILEGE_TYPE=\'EVENT\'',
1145 'result' => [],
1148 'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
1149 . '`SCHEMA_PRIVILEGES`'
1150 . ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
1151 . ' AND PRIVILEGE_TYPE=\'EVENT\' AND \'pma_test\''
1152 . ' LIKE `TABLE_SCHEMA`',
1153 'result' => [],
1156 'query' => 'SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.'
1157 . '`TABLE_PRIVILEGES`'
1158 . ' WHERE GRANTEE=\'\'\'pma_test\'\'@\'\'localhost\'\'\''
1159 . ' AND PRIVILEGE_TYPE=\'EVENT\''
1160 . ' AND TABLE_SCHEMA=\'pma\\\\_test\' AND TABLE_NAME=\'table1\'',
1161 'result' => [],
1164 'query' => 'RENAME TABLE `pma_test`.`table1` TO `pma_test`.`table3`;',
1165 'result' => [],
1168 'query' => 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION,'
1169 . ' EVENT_OBJECT_TABLE, ACTION_TIMING, ACTION_STATEMENT, '
1170 . 'EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER'
1171 . ' FROM information_schema.TRIGGERS'
1172 . ' WHERE EVENT_OBJECT_SCHEMA= \'pma_test\''
1173 . ' AND EVENT_OBJECT_TABLE = \'table1\';',
1174 'result' => [],
1177 'query' => 'SHOW TABLES FROM `pma`;',
1178 'result' => [],
1181 'query' => "SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`."
1182 . "`SCHEMA_PRIVILEGES` WHERE GRANTEE='''pma_test''@''localhost'''"
1183 . " AND PRIVILEGE_TYPE='EVENT' AND TABLE_SCHEMA='pma'",
1184 'result' => [],
1187 'query' => "SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`."
1188 . "`SCHEMA_PRIVILEGES` WHERE GRANTEE='''pma_test''@''localhost'''"
1189 . " AND PRIVILEGE_TYPE='TRIGGER' AND TABLE_SCHEMA='pma'",
1190 'result' => [],
1193 'query' => 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA'
1194 . ' WHERE SCHEMA_NAME = \'pma_test\' LIMIT 1',
1195 'columns' => ['DEFAULT_COLLATION_NAME'],
1196 'result' => [
1197 ['utf8_general_ci'],
1201 'query' => 'SELECT @@collation_database',
1202 'columns' => ['@@collation_database'],
1203 'result' => [
1204 ['bar'],
1208 'query' => "SHOW TABLES FROM `phpmyadmin`",
1209 'result' => [],
1212 'query' => "SELECT tracking_active FROM `pmadb`.`tracking`" .
1213 " WHERE db_name = 'pma_test_db'" .
1214 " AND table_name = 'pma_test_table'" .
1215 " ORDER BY version DESC LIMIT 1",
1216 'columns' => ['tracking_active'],
1217 'result' => [
1218 [1],
1222 'query' => "SELECT tracking_active FROM `pmadb`.`tracking`" .
1223 " WHERE db_name = 'pma_test_db'" .
1224 " AND table_name = 'pma_test_table2'" .
1225 " ORDER BY version DESC LIMIT 1",
1226 'result' => [],
1229 'query' => "SHOW SLAVE STATUS",
1230 'result' => [
1232 'Slave_IO_State' => 'running',
1233 'Master_Host' => 'locahost',
1234 'Master_User' => 'Master_User',
1235 'Master_Port' => '1002',
1236 'Connect_Retry' => 'Connect_Retry',
1237 'Master_Log_File' => 'Master_Log_File',
1238 'Read_Master_Log_Pos' => 'Read_Master_Log_Pos',
1239 'Relay_Log_File' => 'Relay_Log_File',
1240 'Relay_Log_Pos' => 'Relay_Log_Pos',
1241 'Relay_Master_Log_File' => 'Relay_Master_Log_File',
1242 'Slave_IO_Running' => 'NO',
1243 'Slave_SQL_Running' => 'NO',
1244 'Replicate_Do_DB' => 'Replicate_Do_DB',
1245 'Replicate_Ignore_DB' => 'Replicate_Ignore_DB',
1246 'Replicate_Do_Table' => 'Replicate_Do_Table',
1247 'Replicate_Ignore_Table' => 'Replicate_Ignore_Table',
1248 'Replicate_Wild_Do_Table' => 'Replicate_Wild_Do_Table',
1249 'Replicate_Wild_Ignore_Table' => 'Replicate_Wild_Ignore_Table',
1250 'Last_Errno' => 'Last_Errno',
1251 'Last_Error' => 'Last_Error',
1252 'Skip_Counter' => 'Skip_Counter',
1253 'Exec_Master_Log_Pos' => 'Exec_Master_Log_Pos',
1254 'Relay_Log_Space' => 'Relay_Log_Space',
1255 'Until_Condition' => 'Until_Condition',
1256 'Until_Log_File' => 'Until_Log_File',
1257 'Until_Log_Pos' => 'Until_Log_Pos',
1258 'Master_SSL_Allowed' => 'Master_SSL_Allowed',
1259 'Master_SSL_CA_File' => 'Master_SSL_CA_File',
1260 'Master_SSL_CA_Path' => 'Master_SSL_CA_Path',
1261 'Master_SSL_Cert' => 'Master_SSL_Cert',
1262 'Master_SSL_Cipher' => 'Master_SSL_Cipher',
1263 'Master_SSL_Key' => 'Master_SSL_Key',
1264 'Seconds_Behind_Master' => 'Seconds_Behind_Master',
1269 'query' => "SHOW MASTER STATUS",
1270 'result' => [
1272 "File" => "master-bin.000030",
1273 "Position" => "107",
1274 "Binlog_Do_DB" => "Binlog_Do_DB",
1275 "Binlog_Ignore_DB" => "Binlog_Ignore_DB",
1280 'query' => "SHOW GRANTS",
1281 'result' => [],
1284 'query' => "SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`, "
1285 . "(SELECT DB_first_level FROM ( SELECT DISTINCT "
1286 . "SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level "
1287 . "FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t ORDER BY "
1288 . "DB_first_level ASC LIMIT 0, 100) t2 WHERE TRUE AND 1 = LOCATE("
1289 . "CONCAT(DB_first_level, '_'), CONCAT(SCHEMA_NAME, '_')) "
1290 . "ORDER BY SCHEMA_NAME ASC",
1291 'result' => [
1292 "test",
1296 'query' => "SELECT COUNT(*) FROM ( SELECT DISTINCT SUBSTRING_INDEX("
1297 . "SCHEMA_NAME, '_', 1) DB_first_level "
1298 . "FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t",
1299 'result' => [
1300 [1],
1304 'query' => "SELECT `PARTITION_METHOD` "
1305 . "FROM `information_schema`.`PARTITIONS` "
1306 . "WHERE `TABLE_SCHEMA` = 'db' AND `TABLE_NAME` = 'table' LIMIT 1",
1307 'result' => [],
1310 'query' => 'SHOW PLUGINS',
1311 'result' => [
1313 'Name' => 'partition',
1314 'Status' => 'ACTIVE',
1315 'Type' => 'STORAGE ENGINE',
1316 'Library' => null,
1317 'License' => 'GPL',
1322 'query' => 'SELECT * FROM information_schema.PLUGINS ORDER BY PLUGIN_TYPE, PLUGIN_NAME',
1323 'result' => [
1325 'PLUGIN_NAME' => 'BLACKHOLE',
1326 'PLUGIN_VERSION' => '1.0',
1327 'PLUGIN_STATUS' => 'ACTIVE',
1328 'PLUGIN_TYPE' => 'STORAGE ENGINE',
1329 'PLUGIN_TYPE_VERSION' => '100316.0',
1330 'PLUGIN_LIBRARY' => 'ha_blackhole.so',
1331 'PLUGIN_LIBRARY_VERSION' => '1.13',
1332 'PLUGIN_AUTHOR' => 'MySQL AB',
1333 'PLUGIN_DESCRIPTION' => '/dev/null storage engine (anything you write to it disappears)',
1334 'PLUGIN_LICENSE' => 'GPL',
1335 'LOAD_OPTION' => 'ON',
1336 'PLUGIN_MATURITY' => 'Stable',
1337 'PLUGIN_AUTH_VERSION' => '1.0',
1342 'query' => "SHOW FULL TABLES FROM `default` WHERE `Table_type`IN('BASE TABLE', 'SYSTEM VERSIONED')",
1343 'result' => [
1345 "test1",
1346 "BASE TABLE",
1349 "test2",
1350 "BASE TABLE",
1355 'query' => "SHOW FULL TABLES FROM `default` "
1356 . "WHERE `Table_type`NOT IN('BASE TABLE', 'SYSTEM VERSIONED')",
1357 'result' => [],
1360 'query' => "SHOW FUNCTION STATUS WHERE `Db`='default'",
1361 'result' => [["Name" => "testFunction"]],
1364 'query' => "SHOW PROCEDURE STATUS WHERE `Db`='default'",
1365 'result' => [],
1368 'query' => "SHOW EVENTS FROM `default`",
1369 'result' => [],
1372 'query' => "FLUSH PRIVILEGES",
1373 'result' => [],
1376 'query' => "SELECT * FROM `mysql`.`db` LIMIT 1",
1377 'result' => [],
1380 'query' => "SELECT * FROM `mysql`.`columns_priv` LIMIT 1",
1381 'result' => [],
1384 'query' => "SELECT * FROM `mysql`.`tables_priv` LIMIT 1",
1385 'result' => [],
1388 'query' => "SELECT * FROM `mysql`.`procs_priv` LIMIT 1",
1389 'result' => [],
1392 'query' => 'DELETE FROM `mysql`.`db` WHERE `host` = "" '
1393 . 'AND `Db` = "" AND `User` = ""',
1394 'result' => true,
1397 'query' => 'DELETE FROM `mysql`.`columns_priv` WHERE '
1398 . '`host` = "" AND `Db` = "" AND `User` = ""',
1399 'result' => true,
1402 'query' => 'DELETE FROM `mysql`.`tables_priv` WHERE '
1403 . '`host` = "" AND `Db` = "" AND `User` = "" AND Table_name = ""',
1404 'result' => true,
1407 'query' => 'DELETE FROM `mysql`.`procs_priv` WHERE '
1408 . '`host` = "" AND `Db` = "" AND `User` = "" AND `Routine_name` = "" '
1409 . 'AND `Routine_type` = ""',
1410 'result' => true,
1413 'query' => 'SELECT `plugin` FROM `mysql`.`user` WHERE '
1414 . '`User` = "pma_username" AND `Host` = "pma_hostname" LIMIT 1',
1415 'result' => [],
1418 'query' => 'SELECT @@default_authentication_plugin',
1419 'result' => [
1420 ['@@default_authentication_plugin' => 'mysql_native_password'],
1424 'query' => "SELECT TABLE_NAME FROM information_schema.VIEWS WHERE "
1425 . "TABLE_SCHEMA = 'db' AND TABLE_NAME = 'table'",
1426 'result' => [],
1429 'query' => "SELECT *, `TABLE_SCHEMA` AS `Db`, "
1430 . "`TABLE_NAME` AS `Name`, `TABLE_TYPE` AS `TABLE_TYPE`, "
1431 . "`ENGINE` AS `Engine`, `ENGINE` AS `Type`, "
1432 . "`VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`, "
1433 . "`TABLE_ROWS` AS `Rows`, `AVG_ROW_LENGTH` AS `Avg_row_length`, "
1434 . "`DATA_LENGTH` AS `Data_length`, "
1435 . "`MAX_DATA_LENGTH` AS `Max_data_length`, "
1436 . "`INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`, "
1437 . "`AUTO_INCREMENT` AS `Auto_increment`, "
1438 . "`CREATE_TIME` AS `Create_time`, "
1439 . "`UPDATE_TIME` AS `Update_time`, `CHECK_TIME` AS `Check_time`, "
1440 . "`TABLE_COLLATION` AS `Collation`, `CHECKSUM` AS `Checksum`, "
1441 . "`CREATE_OPTIONS` AS `Create_options`, "
1442 . "`TABLE_COMMENT` AS `Comment` "
1443 . "FROM `information_schema`.`TABLES` t "
1444 . "WHERE `TABLE_SCHEMA` IN ('db') "
1445 . "AND t.`TABLE_NAME` = 'table' ORDER BY Name ASC",
1446 'result' => [],
1449 'query' => "SHOW TABLE STATUS FROM `db` WHERE `Name` LIKE 'table%'",
1450 'result' => [],
1453 'query' => "SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,"
1454 . " `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,"
1455 . " `ENGINE` AS `Type`, `VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`,"
1456 . " `TABLE_ROWS` AS `Rows`, `AVG_ROW_LENGTH` AS `Avg_row_length`,"
1457 . " `DATA_LENGTH` AS `Data_length`, `MAX_DATA_LENGTH` AS `Max_data_length`,"
1458 . " `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,"
1459 . " `AUTO_INCREMENT` AS `Auto_increment`, `CREATE_TIME` AS `Create_time`,"
1460 . " `UPDATE_TIME` AS `Update_time`, `CHECK_TIME` AS `Check_time`,"
1461 . " `TABLE_COLLATION` AS `Collation`, `CHECKSUM` AS `Checksum`,"
1462 . " `CREATE_OPTIONS` AS `Create_options`, `TABLE_COMMENT` AS `Comment`"
1463 . " FROM `information_schema`.`TABLES` t WHERE `TABLE_SCHEMA` IN ('table1')"
1464 . " AND t.`TABLE_NAME` = 'pma_test' ORDER BY Name ASC",
1465 'columns' => [
1466 'TABLE_CATALOG',
1467 'TABLE_SCHEMA',
1468 'TABLE_NAME',
1469 'TABLE_TYPE',
1470 'ENGINE',
1471 'VERSION',
1472 'ROW_FORMAT',
1473 'TABLE_ROWS',
1474 'AVG_ROW_LENGTH',
1475 'DATA_LENGTH',
1476 'MAX_DATA_LENGTH',
1477 'INDEX_LENGTH',
1478 'DATA_FREE',
1479 'AUTO_INCREMENT',
1480 'CREATE_TIME',
1481 'UPDATE_TIME',
1482 'CHECK_TIME',
1483 'TABLE_COLLATION',
1484 'CHECKSUM',
1485 'CREATE_OPTIONS',
1486 'TABLE_COMMENT',
1487 'Db',
1488 'Name',
1489 'TABLE_TYPE',
1490 'Engine',
1491 'Type',
1492 'Version',
1493 'Row_format',
1494 'Rows',
1495 'Avg_row_length',
1496 'Data_length',
1497 'Max_data_length',
1498 'Index_length',
1499 'Data_free',
1500 'Auto_increment',
1501 'Create_time',
1502 'Update_time',
1503 'Check_time',
1504 'Collation',
1505 'Checksum',
1506 'Create_options',
1507 'Comment',
1509 'result' => [
1511 'ref',
1512 'pma_test',
1513 'table1',
1514 'BASE TABLE',
1515 'DBIdummy',
1516 '11',
1517 'Redundant',
1518 '123456',
1519 '42',
1520 '21708991',
1521 '281474976710655',// MyISAM
1522 '2048',// MyISAM
1523 '2547',
1524 '5',
1525 '2014-06-24 17:30:00',
1526 '2018-06-25 18:35:12',
1527 '2015-04-24 19:30:59',
1528 'utf8mb4_general_ci',
1529 '3844432963',
1530 'row_format=REDUNDANT',
1531 'Test comment for "table1" in \'pma_test\'',
1532 'table1',
1533 'DBIdummy',
1534 '11',
1535 'Redundant',
1536 '123456',
1537 '42',
1538 '21708991',
1539 '281474976710655',// MyISAM
1540 '2048',// MyISAM
1541 '2547',
1542 '5',
1543 '2014-06-24 17:30:00',
1544 '2018-06-25 18:35:12',
1545 '2015-04-24 19:30:59',
1546 'utf8mb4_general_ci',
1547 '3844432963',
1548 'row_format=REDUNDANT',
1549 'Test comment for "table1" in \'pma_test\'',
1554 'query' => "SHOW TABLE STATUS FROM `table1` WHERE `Name` LIKE 'pma\_test%'",
1555 'columns' => [
1556 'Name',
1557 'TABLE_TYPE',
1558 'Engine',
1559 'Type',
1560 'Version',
1561 'Row_format',
1562 'Rows',
1563 'Avg_row_length',
1564 'Data_length',
1565 'Max_data_length',
1566 'Index_length',
1567 'Data_free',
1568 'Auto_increment',
1569 'Create_time',
1570 'Update_time',
1571 'Check_time',
1572 'Collation',
1573 'Checksum',
1574 'Create_options',
1575 'Comment',
1577 'result' => [
1579 'table1',
1580 'DBIdummy',
1581 '11',
1582 'Redundant',
1583 '123456',
1584 '42',
1585 '21708991',
1586 '281474976710655',// MyISAM
1587 '2048',// MyISAM
1588 '2547',
1589 '5',
1590 '2014-06-24 17:30:00',
1591 '2018-06-25 18:35:12',
1592 '2015-04-24 19:30:59',
1593 'utf8mb4_general_ci',
1594 '3844432963',
1595 'row_format=REDUNDANT',
1596 'Test comment for "table1" in \'pma_test\'',
1601 'query' => "SELECT *, CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME FROM (SELECT BINARY s.SCHEMA_NAME AS BIN_NAME, s.DEFAULT_COLLATION_NAME FROM `information_schema`.SCHEMATA s WHERE `SCHEMA_NAME` LIKE 'pma_test' GROUP BY BINARY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME ORDER BY BINARY `SCHEMA_NAME` ASC) a",
1602 'result' => [
1604 'BIN_NAME' => 'pma_test',
1605 'DEFAULT_COLLATION_NAME' => 'utf8mb4_general_ci',
1606 'SCHEMA_NAME' => 'pma_test',
1611 'query' => "SELECT *, CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME FROM (SELECT BINARY s.SCHEMA_NAME AS BIN_NAME, s.DEFAULT_COLLATION_NAME FROM `information_schema`.SCHEMATA s GROUP BY BINARY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME ORDER BY BINARY `SCHEMA_NAME` ASC) a",
1612 'columns' => [
1613 'BIN_NAME',
1614 'DEFAULT_COLLATION_NAME',
1615 'SCHEMA_NAME',
1617 'result' => [
1619 'sakila',
1620 'utf8_general_ci',
1621 'sakila',
1624 'employees',
1625 'latin1_swedish_ci',
1626 'employees',
1632 'query' => "SELECT *, CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME FROM (SELECT BINARY s.SCHEMA_NAME AS BIN_NAME, s.DEFAULT_COLLATION_NAME, COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES, SUM(t.TABLE_ROWS) AS SCHEMA_TABLE_ROWS, SUM(t.DATA_LENGTH) AS SCHEMA_DATA_LENGTH, SUM(t.MAX_DATA_LENGTH) AS SCHEMA_MAX_DATA_LENGTH, SUM(t.INDEX_LENGTH) AS SCHEMA_INDEX_LENGTH, SUM(t.DATA_LENGTH + t.INDEX_LENGTH) AS SCHEMA_LENGTH, SUM(IF(t.ENGINE <> 'InnoDB', t.DATA_FREE, 0)) AS SCHEMA_DATA_FREE FROM `information_schema`.SCHEMATA s LEFT JOIN `information_schema`.TABLES t ON BINARY t.TABLE_SCHEMA = BINARY s.SCHEMA_NAME GROUP BY BINARY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME ORDER BY `SCHEMA_TABLES` DESC) a",
1633 'columns' => [
1634 'BIN_NAME',
1635 'DEFAULT_COLLATION_NAME',
1636 'SCHEMA_TABLES',
1637 'SCHEMA_TABLE_ROWS',
1638 'SCHEMA_DATA_LENGTH',
1639 'SCHEMA_INDEX_LENGTH',
1640 'SCHEMA_LENGTH',
1641 'SCHEMA_DATA_FREE',
1642 'SCHEMA_NAME',
1644 'result' => [
1646 'sakila',
1647 'utf8_general_ci',
1648 '23',
1649 '47274',
1650 '4358144',
1651 '2392064',
1652 '6750208',
1653 '0',
1654 'sakila',
1657 'employees',
1658 'latin1_swedish_ci',
1659 '8',
1660 '3912174',
1661 '148111360',
1662 '5816320',
1663 '153927680',
1664 '0',
1665 'employees',
1670 'query' => "SELECT @@have_partitioning;",
1671 'result' => [],
1674 'query' => "SELECT @@lower_case_table_names",
1675 'result' => [],
1678 'query' => "SELECT `PLUGIN_NAME`, `PLUGIN_DESCRIPTION` "
1679 . "FROM `information_schema`.`PLUGINS` "
1680 . "WHERE `PLUGIN_TYPE` = 'AUTHENTICATION';",
1681 'result' => [],
1684 'query' => "SHOW TABLES FROM `db`;",
1685 'result' => [],
1688 'query' => "SELECT `PRIVILEGE_TYPE` FROM "
1689 . "`INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES` "
1690 . "WHERE GRANTEE='''pma_test''@''localhost''' "
1691 . "AND PRIVILEGE_TYPE='EVENT' AND 'db' LIKE `TABLE_SCHEMA`",
1692 'result' => [],
1695 'query' => "SELECT `PRIVILEGE_TYPE` FROM "
1696 . "`INFORMATION_SCHEMA`.`SCHEMA_PRIVILEGES` "
1697 . "WHERE GRANTEE='''pma_test''@''localhost''' "
1698 . "AND PRIVILEGE_TYPE='TRIGGER' AND 'db' LIKE `TABLE_SCHEMA`",
1699 'result' => [],
1702 'query' => "SELECT (COUNT(DB_first_level) DIV 100) * 100 from "
1703 . "( SELECT distinct SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) "
1704 . "DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA "
1705 . "WHERE `SCHEMA_NAME` < 'db' ) t",
1706 'result' => [],
1709 'query' => "SELECT (COUNT(DB_first_level) DIV 100) * 100 from "
1710 . "( SELECT distinct SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) "
1711 . "DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA "
1712 . "WHERE `SCHEMA_NAME` < 'pma_test' ) t",
1713 'result' => [],
1716 'query' => "SELECT `SCHEMA_NAME` FROM "
1717 . "`INFORMATION_SCHEMA`.`SCHEMATA`, "
1718 . "(SELECT DB_first_level FROM ( SELECT DISTINCT "
1719 . "SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM "
1720 . "INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t "
1721 . "ORDER BY DB_first_level ASC LIMIT , 100) t2 WHERE TRUE AND "
1722 . "1 = LOCATE(CONCAT(DB_first_level, '_'), "
1723 . "CONCAT(SCHEMA_NAME, '_')) ORDER BY SCHEMA_NAME ASC",
1724 'result' => [],
1727 'query' => 'SELECT @@ndb_version_string',
1728 'result' => [['ndb-7.4.10']],
1731 'query' => "SELECT *, `COLUMN_NAME` AS `Field`, `COLUMN_TYPE` AS `Type`, `COLLATION_NAME` AS `Collation`, `IS_NULLABLE` AS `Null`, `COLUMN_KEY` AS `Key`, `COLUMN_DEFAULT` AS `Default`, `EXTRA` AS `Extra`, `PRIVILEGES` AS `Privileges`, `COLUMN_COMMENT` AS `Comment` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = 'information_schema' AND `TABLE_NAME` = 'PMA'",
1732 'result' => [],
1735 'query' => "SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM information_schema.key_column_usage WHERE referenced_table_name IS NOT NULL AND TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('table1','table2') AND REFERENCED_TABLE_NAME IN ('table1','table2');",
1736 'result' => [
1738 'TABLE_NAME' => 'table2',
1739 'COLUMN_NAME' => 'idtable2',
1740 'REFERENCED_TABLE_NAME' => 'table1',
1741 'REFERENCED_COLUMN_NAME' => 'idtable1',
1746 'query' => "SELECT `item_name`, `item_type` FROM `pmadb`.`navigationhiding` WHERE `username`='user' AND `db_name`='db' AND `table_name`=''",
1747 'result' => [
1749 'item_name' => 'tableName',
1750 'item_type' => 'table',
1753 'item_name' => 'viewName',
1754 'item_type' => 'view',
1761 * Current database.
1763 $GLOBALS['dummy_db'] = '';
1765 /* Some basic setup for dummy driver */
1766 $GLOBALS['cfg']['DBG']['sql'] = false;