Merge pull request #18262 from kamil-tekiela/Fix-bug-and-optimize-export
Optimize export of many tables
This commit is contained in:
commit
5e0caaf099
@ -416,6 +416,7 @@ class DatabaseInterface implements DbalInterface
|
||||
$sql .= ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
|
||||
}
|
||||
|
||||
/** @var mixed[][][] $tables */
|
||||
$tables = $this->fetchResult(
|
||||
$sql,
|
||||
[
|
||||
@ -441,7 +442,7 @@ class DatabaseInterface implements DbalInterface
|
||||
[
|
||||
$tables[$one_database_name][$one_table_name]['Data_length'],
|
||||
$tables[$one_database_name][$one_table_name]['Index_length'],
|
||||
] = StorageEngine::getMroongaLengths($one_database_name, $one_table_name);
|
||||
] = StorageEngine::getMroongaLengths($one_database_name, (string) $one_table_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,6 +481,15 @@ class DatabaseInterface implements DbalInterface
|
||||
$tables[$one_database_name] = $one_database_tables;
|
||||
}
|
||||
}
|
||||
|
||||
// on windows with lower_case_table_names = 1
|
||||
// MySQL returns
|
||||
// with SHOW DATABASES or information_schema.SCHEMATA: `Test`
|
||||
// but information_schema.TABLES gives `test`
|
||||
// see https://github.com/phpmyadmin/phpmyadmin/issues/8402
|
||||
$tables = $tables[$database]
|
||||
?? $tables[mb_strtolower($database)]
|
||||
?? [];
|
||||
}
|
||||
|
||||
// If permissions are wrong on even one database directory,
|
||||
@ -500,8 +510,7 @@ class DatabaseInterface implements DbalInterface
|
||||
$this,
|
||||
'escapeString',
|
||||
],
|
||||
$table,
|
||||
$link
|
||||
$table
|
||||
)
|
||||
) . '\')';
|
||||
} else {
|
||||
@ -588,24 +597,12 @@ class DatabaseInterface implements DbalInterface
|
||||
$each_tables = array_slice($each_tables, $limit_offset, $limit_count, true);
|
||||
}
|
||||
|
||||
$tables[$database] = Compatibility::getISCompatForGetTablesFull($each_tables, $database);
|
||||
$tables = Compatibility::getISCompatForGetTablesFull($each_tables, $database);
|
||||
}
|
||||
|
||||
// cache table data
|
||||
// so Table does not require to issue SHOW TABLE STATUS again
|
||||
$this->cache->cacheTableData($tables, $table);
|
||||
|
||||
if (isset($tables[$database])) {
|
||||
return $tables[$database];
|
||||
}
|
||||
|
||||
if (isset($tables[mb_strtolower($database)])) {
|
||||
// on windows with lower_case_table_names = 1
|
||||
// MySQL returns
|
||||
// with SHOW DATABASES or information_schema.SCHEMATA: `Test`
|
||||
// but information_schema.TABLES gives `test`
|
||||
// see https://github.com/phpmyadmin/phpmyadmin/issues/8402
|
||||
return $tables[mb_strtolower($database)];
|
||||
if ($tables !== []) {
|
||||
// cache table data, so Table does not require to issue SHOW TABLE STATUS again
|
||||
$this->cache->cacheTableData($database, $tables);
|
||||
}
|
||||
|
||||
return $tables;
|
||||
|
||||
@ -750,6 +750,13 @@ class Export
|
||||
|
||||
$views = [];
|
||||
|
||||
if ($tables !== []) {
|
||||
// Prefetch table information to improve performance.
|
||||
// Table status will get saved in Query Cache,
|
||||
// and all instantiations of Table below should be much faster.
|
||||
$this->dbi->getTablesFull($db, $tables);
|
||||
}
|
||||
|
||||
foreach ($tables as $table) {
|
||||
$tableObject = new Table($table, $db);
|
||||
// if this is a view, collect it for later;
|
||||
|
||||
@ -15,37 +15,27 @@ use function is_array;
|
||||
*/
|
||||
class Cache
|
||||
{
|
||||
/** @var array Table data cache */
|
||||
/** @var array[] Table data cache */
|
||||
private $tableCache = [];
|
||||
|
||||
/**
|
||||
* Caches table data so Table does not require to issue
|
||||
* SHOW TABLE STATUS again
|
||||
*
|
||||
* @param array $tables information for tables of some databases
|
||||
* @param string|bool $table table name
|
||||
* @param mixed[][] $tables information for tables of some databases
|
||||
*/
|
||||
public function cacheTableData(array $tables, $table): void
|
||||
public function cacheTableData(string $database, array $tables): void
|
||||
{
|
||||
// Note: I don't see why we would need array_merge_recursive() here,
|
||||
// as it creates double entries for the same table (for example a double
|
||||
// entry for Comment when changing the storage engine in Operations)
|
||||
// Note 2: Instead of array_merge(), simply use the + operator because
|
||||
// array_merge() renumbers numeric keys starting with 0, therefore
|
||||
// we would lose a db name that consists only of numbers
|
||||
// Note: This function must not use array_merge because numerical indices must be preserved.
|
||||
// When an entry already exists for the database in cache, we merge the incoming data with existing data.
|
||||
// The union operator appends elements from right to left unless they exists on the left already.
|
||||
// Doing the union with incoming data on the left ensures that when we reread table status from DB,
|
||||
// we overwrite whatever was in cache with the new data.
|
||||
|
||||
foreach ($tables as $one_database => $_) {
|
||||
if (isset($this->tableCache[$one_database])) {
|
||||
// the + operator does not do the intended effect
|
||||
// when the cache for one table already exists
|
||||
if ($table && isset($this->tableCache[$one_database][$table])) {
|
||||
unset($this->tableCache[$one_database][$table]);
|
||||
}
|
||||
|
||||
$this->tableCache[$one_database] += $tables[$one_database];
|
||||
} else {
|
||||
$this->tableCache[$one_database] = $tables[$one_database];
|
||||
}
|
||||
if (isset($this->tableCache[$database])) {
|
||||
$this->tableCache[$database] = $tables + $this->tableCache[$database];
|
||||
} else {
|
||||
$this->tableCache[$database] = $tables;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ use function substr;
|
||||
*/
|
||||
class Compatibility
|
||||
{
|
||||
/** @return mixed[][] */
|
||||
public static function getISCompatForGetTablesFull(array $eachTables, string $eachDatabase): array
|
||||
{
|
||||
foreach ($eachTables as $table_name => $_) {
|
||||
|
||||
@ -2765,16 +2765,6 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/DatabaseInterface.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$table of method PhpMyAdmin\\\\Query\\\\Cache\\:\\:cacheTableData\\(\\) expects bool\\|string, array\\|string given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/DatabaseInterface.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\.\\.\\.\\$args of function array_map expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/DatabaseInterface.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#4 \\$link of method PhpMyAdmin\\\\DatabaseInterface\\:\\:fetchResult\\(\\) expects int, mixed given\\.$#"
|
||||
count: 7
|
||||
@ -7050,11 +7040,6 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Query/Cache.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Query\\\\Cache\\:\\:cacheTableData\\(\\) has parameter \\$tables with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Query/Cache.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Query\\\\Cache\\:\\:getCache\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -7085,11 +7070,6 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Query/Compatibility.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Query\\\\Compatibility\\:\\:getISCompatForGetTablesFull\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Query/Compatibility.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Query\\\\Generator\\:\\:getInformationSchemaColumnsFullRequest\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -5772,7 +5772,7 @@
|
||||
<InvalidReturnType occurrences="1">
|
||||
<code>int|bool</code>
|
||||
</InvalidReturnType>
|
||||
<MixedArgument occurrences="50">
|
||||
<MixedArgument occurrences="46">
|
||||
<code>$a</code>
|
||||
<code>$arrayKeys</code>
|
||||
<code>$b</code>
|
||||
@ -5794,10 +5794,6 @@
|
||||
<code>$link</code>
|
||||
<code>$link</code>
|
||||
<code>$link</code>
|
||||
<code>$link</code>
|
||||
<code>$one_database_tables</code>
|
||||
<code>$one_database_tables</code>
|
||||
<code>$one_table_name</code>
|
||||
<code>$password</code>
|
||||
<code>$server</code>
|
||||
<code>$sql</code>
|
||||
@ -5824,23 +5820,20 @@
|
||||
<code>$user</code>
|
||||
<code>$warningsCount</code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion occurrences="6">
|
||||
<MixedArgumentTypeCoercion occurrences="5">
|
||||
<code>$one_database_name</code>
|
||||
<code>$one_database_tables</code>
|
||||
<code>$one_database_tables</code>
|
||||
<code>$table_name</code>
|
||||
<code>uksort($each_tables, 'strnatcasecmp')</code>
|
||||
<code>uksort($one_database_tables, 'strnatcasecmp')</code>
|
||||
<code>usort($tables, 'strnatcasecmp')</code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedArrayAccess occurrences="34">
|
||||
<MixedArrayAccess occurrences="32">
|
||||
<code>$event['Name']</code>
|
||||
<code>$event['Status']</code>
|
||||
<code>$event['Type']</code>
|
||||
<code>$link</code>
|
||||
<code>$one_show['Db']</code>
|
||||
<code>$one_show['Name']</code>
|
||||
<code>$one_show['Type']</code>
|
||||
<code>$one_table_data['Engine']</code>
|
||||
<code>$routine['DTD_IDENTIFIER']</code>
|
||||
<code>$routine['Db']</code>
|
||||
<code>$routine['Definer']</code>
|
||||
@ -5888,7 +5881,7 @@
|
||||
<code>$this->links[$link]</code>
|
||||
<code>$this->links[$link]</code>
|
||||
</MixedArrayOffset>
|
||||
<MixedAssignment occurrences="42">
|
||||
<MixedAssignment occurrences="37">
|
||||
<code>$aLength</code>
|
||||
<code>$bLength</code>
|
||||
<code>$database</code>
|
||||
@ -5899,9 +5892,6 @@
|
||||
<code>$grant</code>
|
||||
<code>$key_index</code>
|
||||
<code>$map['real_column']</code>
|
||||
<code>$one_database_tables</code>
|
||||
<code>$one_database_tables</code>
|
||||
<code>$one_database_tables</code>
|
||||
<code>$one_result['action_timing']</code>
|
||||
<code>$one_result['definer']</code>
|
||||
<code>$one_result['definition']</code>
|
||||
@ -5909,8 +5899,6 @@
|
||||
<code>$one_result['name']</code>
|
||||
<code>$one_result['table']</code>
|
||||
<code>$one_show</code>
|
||||
<code>$one_table_data</code>
|
||||
<code>$one_table_name</code>
|
||||
<code>$result</code>
|
||||
<code>$result[]</code>
|
||||
<code>$result_target</code>
|
||||
@ -5932,8 +5920,7 @@
|
||||
<code>$trigger['TRIGGER_NAME']</code>
|
||||
<code>$warningsCount</code>
|
||||
</MixedAssignment>
|
||||
<MixedInferredReturnType occurrences="3">
|
||||
<code>array</code>
|
||||
<MixedInferredReturnType occurrences="2">
|
||||
<code>array</code>
|
||||
<code>string</code>
|
||||
</MixedInferredReturnType>
|
||||
@ -5948,9 +5935,7 @@
|
||||
<MixedPropertyFetch occurrences="1">
|
||||
<code>$this->links[$link]->warning_count</code>
|
||||
</MixedPropertyFetch>
|
||||
<MixedReturnStatement occurrences="4">
|
||||
<code>$tables[$database]</code>
|
||||
<code>$tables[mb_strtolower($database)]</code>
|
||||
<MixedReturnStatement occurrences="2">
|
||||
<code>SessionCache::get('mysql_cur_user')</code>
|
||||
<code>reset($columns)</code>
|
||||
</MixedReturnStatement>
|
||||
@ -5962,9 +5947,6 @@
|
||||
<code>$user</code>
|
||||
<code>SessionCache::get('mysql_cur_user')</code>
|
||||
</NullableReturnStatement>
|
||||
<PossiblyInvalidArgument occurrences="1">
|
||||
<code>$table</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyInvalidArrayOffset occurrences="1">
|
||||
<code>$row[$value]</code>
|
||||
</PossiblyInvalidArrayOffset>
|
||||
@ -12124,9 +12106,6 @@
|
||||
</ImplementedReturnTypeMismatch>
|
||||
</file>
|
||||
<file src="libraries/classes/Query/Cache.php">
|
||||
<MixedArrayAccess occurrences="1">
|
||||
<code>$this->tableCache[$one_database][$table]</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayOffset occurrences="3">
|
||||
<code>$loc[$key]</code>
|
||||
<code>$loc[$key]</code>
|
||||
@ -12137,9 +12116,6 @@
|
||||
<code>$loc</code>
|
||||
<code>$loc[array_shift($contentPath)]</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand occurrences="1">
|
||||
<code>$this->tableCache[$one_database]</code>
|
||||
</MixedOperand>
|
||||
</file>
|
||||
<file src="libraries/classes/Query/Compatibility.php">
|
||||
<MixedArgument occurrences="1">
|
||||
@ -12252,6 +12228,10 @@
|
||||
<code>$eachTables[$table_name]['UPDATE_TIME']</code>
|
||||
<code>$eachTables[$table_name]['VERSION']</code>
|
||||
</MixedAssignment>
|
||||
<MixedReturnTypeCoercion occurrences="2">
|
||||
<code>$eachTables</code>
|
||||
<code>mixed[][]</code>
|
||||
</MixedReturnTypeCoercion>
|
||||
</file>
|
||||
<file src="libraries/classes/Query/Generator.php">
|
||||
<MixedArgumentTypeCoercion occurrences="1">
|
||||
|
||||
@ -1182,152 +1182,45 @@ class DbiDummy implements DbiExtension
|
||||
],
|
||||
'result' => [
|
||||
[
|
||||
'def',
|
||||
'smash',
|
||||
'issues_issue',
|
||||
'ref',
|
||||
'pma_test',
|
||||
'table1',
|
||||
'BASE TABLE',
|
||||
'InnoDB',
|
||||
'10',
|
||||
'Compact',
|
||||
'9136',
|
||||
'862',
|
||||
'7880704',
|
||||
'0',
|
||||
'1032192',
|
||||
'420478976',
|
||||
'155862',
|
||||
'2012-08-29 13:28:28',
|
||||
'NULL',
|
||||
'NULL',
|
||||
'utf8_general_ci',
|
||||
'NULL',
|
||||
'',
|
||||
'',
|
||||
'smash',
|
||||
'issues_issue',
|
||||
'BASE TABLE',
|
||||
'InnoDB',
|
||||
'InnoDB',
|
||||
'10',
|
||||
'Compact',
|
||||
'9136',
|
||||
'862',
|
||||
'7880704',
|
||||
'0',
|
||||
'1032192',
|
||||
'420478976',
|
||||
'155862',
|
||||
'2012-08-29 13:28:28',
|
||||
'NULL',
|
||||
'NULL',
|
||||
'utf8_general_ci',
|
||||
'NULL',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,'
|
||||
. ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,'
|
||||
. ' `ENGINE` AS `Type`, `VERSION` AS `Version`,'
|
||||
. ' `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`,'
|
||||
. ' `AVG_ROW_LENGTH` AS `Avg_row_length`,'
|
||||
. ' `DATA_LENGTH` AS `Data_length`,'
|
||||
. ' `MAX_DATA_LENGTH` AS `Max_data_length`,'
|
||||
. ' `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,'
|
||||
. ' `AUTO_INCREMENT` AS `Auto_increment`,'
|
||||
. ' `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`,'
|
||||
. ' `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`,'
|
||||
. ' `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`,'
|
||||
. ' `TABLE_COMMENT` AS `Comment`'
|
||||
. ' FROM `information_schema`.`TABLES` t'
|
||||
. ' WHERE `TABLE_SCHEMA` IN (\'pma_test\')'
|
||||
. ' AND t.`TABLE_NAME` = \'table1\' ORDER BY Name ASC',
|
||||
'columns' => [
|
||||
'TABLE_CATALOG',
|
||||
'TABLE_SCHEMA',
|
||||
'TABLE_NAME',
|
||||
'TABLE_TYPE',
|
||||
'ENGINE',
|
||||
'VERSION',
|
||||
'ROW_FORMAT',
|
||||
'TABLE_ROWS',
|
||||
'AVG_ROW_LENGTH',
|
||||
'DATA_LENGTH',
|
||||
'MAX_DATA_LENGTH',
|
||||
'INDEX_LENGTH',
|
||||
'DATA_FREE',
|
||||
'AUTO_INCREMENT',
|
||||
'CREATE_TIME',
|
||||
'UPDATE_TIME',
|
||||
'CHECK_TIME',
|
||||
'TABLE_COLLATION',
|
||||
'CHECKSUM',
|
||||
'CREATE_OPTIONS',
|
||||
'TABLE_COMMENT',
|
||||
'Db',
|
||||
'Name',
|
||||
'TABLE_TYPE',
|
||||
'Engine',
|
||||
'Type',
|
||||
'Version',
|
||||
'Row_format',
|
||||
'Rows',
|
||||
'Avg_row_length',
|
||||
'Data_length',
|
||||
'Max_data_length',
|
||||
'Index_length',
|
||||
'Data_free',
|
||||
'Auto_increment',
|
||||
'Create_time',
|
||||
'Update_time',
|
||||
'Check_time',
|
||||
'Collation',
|
||||
'Checksum',
|
||||
'Create_options',
|
||||
'Comment',
|
||||
],
|
||||
'result' => [
|
||||
[
|
||||
'def',
|
||||
'smash',
|
||||
'issues_issue',
|
||||
'BASE TABLE',
|
||||
'InnoDB',
|
||||
'10',
|
||||
'Compact',
|
||||
'9136',
|
||||
'862',
|
||||
'7880704',
|
||||
'0',
|
||||
'1032192',
|
||||
'420478976',
|
||||
'155862',
|
||||
'2012-08-29 13:28:28',
|
||||
'NULL',
|
||||
'NULL',
|
||||
'utf8_general_ci',
|
||||
'NULL',
|
||||
'',
|
||||
'',
|
||||
'smash',
|
||||
'issues_issue',
|
||||
'BASE TABLE',
|
||||
'InnoDB',
|
||||
'InnoDB',
|
||||
'10',
|
||||
'Compact',
|
||||
'9136',
|
||||
'862',
|
||||
'7880704',
|
||||
'0',
|
||||
'1032192',
|
||||
'420478976',
|
||||
'155862',
|
||||
'2012-08-29 13:28:28',
|
||||
'NULL',
|
||||
'NULL',
|
||||
'utf8_general_ci',
|
||||
'NULL',
|
||||
'DBIdummy',
|
||||
'11',
|
||||
'Redundant',
|
||||
'123456',
|
||||
'42',
|
||||
'21708991',
|
||||
'281474976710655',// MyISAM
|
||||
'2048',// MyISAM
|
||||
'2547',
|
||||
'5',
|
||||
'2014-06-24 17:30:00',
|
||||
'2018-06-25 18:35:12',
|
||||
'2015-04-24 19:30:59',
|
||||
'utf8mb4_general_ci',
|
||||
'3844432963',
|
||||
'row_format=REDUNDANT',
|
||||
'Test comment for "table1" in \'pma_test\'',
|
||||
'table1',
|
||||
'DBIdummy',
|
||||
'11',
|
||||
'Redundant',
|
||||
'123456',
|
||||
'42',
|
||||
'21708991',
|
||||
'281474976710655',// MyISAM
|
||||
'2048',// MyISAM
|
||||
'2547',
|
||||
'5',
|
||||
'2014-06-24 17:30:00',
|
||||
'2018-06-25 18:35:12',
|
||||
'2015-04-24 19:30:59',
|
||||
'utf8mb4_general_ci',
|
||||
'3844432963',
|
||||
'row_format=REDUNDANT',
|
||||
'Test comment for "table1" in \'pma_test\'',
|
||||
],
|
||||
],
|
||||
],
|
||||
@ -1769,44 +1662,7 @@ class DbiDummy implements DbiExtension
|
||||
],
|
||||
[
|
||||
'query' => "SHOW TABLE STATUS FROM `my_dataset` WHERE `Name` LIKE 'company\\\\_users%'",
|
||||
'result' => [],
|
||||
],
|
||||
[
|
||||
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,'
|
||||
. ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`,'
|
||||
. ' `ENGINE` AS `Type`, `VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`,'
|
||||
. ' `TABLE_ROWS` AS `Rows`, `AVG_ROW_LENGTH` AS `Avg_row_length`,'
|
||||
. ' `DATA_LENGTH` AS `Data_length`, `MAX_DATA_LENGTH` AS `Max_data_length`,'
|
||||
. ' `INDEX_LENGTH` AS `Index_length`, `DATA_FREE` AS `Data_free`,'
|
||||
. ' `AUTO_INCREMENT` AS `Auto_increment`, `CREATE_TIME` AS `Create_time`,'
|
||||
. ' `UPDATE_TIME` AS `Update_time`, `CHECK_TIME` AS `Check_time`,'
|
||||
. ' `TABLE_COLLATION` AS `Collation`, `CHECKSUM` AS `Checksum`,'
|
||||
. ' `CREATE_OPTIONS` AS `Create_options`, `TABLE_COMMENT` AS `Comment`'
|
||||
. " FROM `information_schema`.`TABLES` t WHERE `TABLE_SCHEMA` IN ('table1')"
|
||||
. " AND t.`TABLE_NAME` = 'pma_test' ORDER BY Name ASC",
|
||||
'columns' => [
|
||||
'TABLE_CATALOG',
|
||||
'TABLE_SCHEMA',
|
||||
'TABLE_NAME',
|
||||
'TABLE_TYPE',
|
||||
'ENGINE',
|
||||
'VERSION',
|
||||
'ROW_FORMAT',
|
||||
'TABLE_ROWS',
|
||||
'AVG_ROW_LENGTH',
|
||||
'DATA_LENGTH',
|
||||
'MAX_DATA_LENGTH',
|
||||
'INDEX_LENGTH',
|
||||
'DATA_FREE',
|
||||
'AUTO_INCREMENT',
|
||||
'CREATE_TIME',
|
||||
'UPDATE_TIME',
|
||||
'CHECK_TIME',
|
||||
'TABLE_COLLATION',
|
||||
'CHECKSUM',
|
||||
'CREATE_OPTIONS',
|
||||
'TABLE_COMMENT',
|
||||
'Db',
|
||||
'Name',
|
||||
'TABLE_TYPE',
|
||||
'Engine',
|
||||
@ -1830,16 +1686,13 @@ class DbiDummy implements DbiExtension
|
||||
],
|
||||
'result' => [
|
||||
[
|
||||
'ref',
|
||||
'pma_test',
|
||||
'table1',
|
||||
'BASE TABLE',
|
||||
'company_users',
|
||||
'DBIdummy',
|
||||
'11',
|
||||
'Redundant',
|
||||
'123456',
|
||||
'42',
|
||||
'21708991',
|
||||
'18',
|
||||
'281474976710655',// MyISAM
|
||||
'2048',// MyISAM
|
||||
'2547',
|
||||
@ -1850,25 +1703,7 @@ class DbiDummy implements DbiExtension
|
||||
'utf8mb4_general_ci',
|
||||
'3844432963',
|
||||
'row_format=REDUNDANT',
|
||||
'Test comment for "table1" in \'pma_test\'',
|
||||
'table1',
|
||||
'DBIdummy',
|
||||
'11',
|
||||
'Redundant',
|
||||
'123456',
|
||||
'42',
|
||||
'21708991',
|
||||
'281474976710655',// MyISAM
|
||||
'2048',// MyISAM
|
||||
'2547',
|
||||
'5',
|
||||
'2014-06-24 17:30:00',
|
||||
'2018-06-25 18:35:12',
|
||||
'2015-04-24 19:30:59',
|
||||
'utf8mb4_general_ci',
|
||||
'3844432963',
|
||||
'row_format=REDUNDANT',
|
||||
'Test comment for "table1" in \'pma_test\'',
|
||||
'Test comment for "company_users" in \'my_dataset\'',
|
||||
],
|
||||
],
|
||||
],
|
||||
@ -2990,6 +2825,162 @@ class DbiDummy implements DbiExtension
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'query' => 'SELECT *, `TABLE_SCHEMA` AS `Db`, `TABLE_NAME` AS `Name`,'
|
||||
. ' `TABLE_TYPE` AS `TABLE_TYPE`, `ENGINE` AS `Engine`, `ENGINE` AS `Type`,'
|
||||
. ' `VERSION` AS `Version`, `ROW_FORMAT` AS `Row_format`, `TABLE_ROWS` AS `Rows`,'
|
||||
. ' `AVG_ROW_LENGTH` AS `Avg_row_length`, `DATA_LENGTH` AS `Data_length`,'
|
||||
. ' `MAX_DATA_LENGTH` AS `Max_data_length`, `INDEX_LENGTH` AS `Index_length`,'
|
||||
. ' `DATA_FREE` AS `Data_free`, `AUTO_INCREMENT` AS `Auto_increment`,'
|
||||
. ' `CREATE_TIME` AS `Create_time`, `UPDATE_TIME` AS `Update_time`,'
|
||||
. ' `CHECK_TIME` AS `Check_time`, `TABLE_COLLATION` AS `Collation`,'
|
||||
. ' `CHECKSUM` AS `Checksum`, `CREATE_OPTIONS` AS `Create_options`,'
|
||||
. ' `TABLE_COMMENT` AS `Comment` FROM `information_schema`.`TABLES` t'
|
||||
. ' WHERE `TABLE_SCHEMA` IN (\'test_db\') AND t.`TABLE_NAME` IN (\'test_table\') ORDER BY Name ASC',
|
||||
'columns' => [
|
||||
'TABLE_CATALOG',
|
||||
'TABLE_SCHEMA',
|
||||
'TABLE_NAME',
|
||||
'TABLE_TYPE',
|
||||
'ENGINE',
|
||||
'VERSION',
|
||||
'ROW_FORMAT',
|
||||
'TABLE_ROWS',
|
||||
'AVG_ROW_LENGTH',
|
||||
'DATA_LENGTH',
|
||||
'MAX_DATA_LENGTH',
|
||||
'INDEX_LENGTH',
|
||||
'DATA_FREE',
|
||||
'AUTO_INCREMENT',
|
||||
'CREATE_TIME',
|
||||
'UPDATE_TIME',
|
||||
'CHECK_TIME',
|
||||
'TABLE_COLLATION',
|
||||
'CHECKSUM',
|
||||
'CREATE_OPTIONS',
|
||||
'TABLE_COMMENT',
|
||||
'MAX_INDEX_LENGTH',
|
||||
'TEMPORARY',
|
||||
'Db',
|
||||
'Name',
|
||||
'TABLE_TYPE',
|
||||
'Engine',
|
||||
'Type',
|
||||
'Version',
|
||||
'Row_format',
|
||||
'Rows',
|
||||
'Avg_row_length',
|
||||
'Data_length',
|
||||
'Max_data_length',
|
||||
'Index_length',
|
||||
'Data_free',
|
||||
'Auto_increment',
|
||||
'Create_time',
|
||||
'Update_time',
|
||||
'Check_time',
|
||||
'Collation',
|
||||
'Checksum',
|
||||
'Create_options',
|
||||
'Comment',
|
||||
],
|
||||
'result' => [
|
||||
[
|
||||
'def',
|
||||
'test_db',
|
||||
'test_table',
|
||||
'BASE TABLE',
|
||||
'InnoDB',
|
||||
'10',
|
||||
'Dynamic',
|
||||
'3',
|
||||
'5461',
|
||||
'16384',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'4',
|
||||
'2011-12-13 14:15:16',
|
||||
null,
|
||||
null,
|
||||
'utf8mb4_general_ci',
|
||||
null,
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
'N',
|
||||
'test_db',
|
||||
'test_table',
|
||||
'BASE TABLE',
|
||||
'InnoDB',
|
||||
'InnoDB',
|
||||
'10',
|
||||
'Dynamic',
|
||||
'3',
|
||||
'5461',
|
||||
'16384',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'4',
|
||||
'2011-12-13 14:15:16',
|
||||
null,
|
||||
null,
|
||||
'utf8mb4_general_ci',
|
||||
null,
|
||||
'',
|
||||
'',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'query' => 'SHOW TABLE STATUS FROM `pma_test` WHERE `Name` LIKE \'table1%\'',
|
||||
'columns' => [
|
||||
'Name',
|
||||
'Engine',
|
||||
'Version',
|
||||
'Row_format',
|
||||
'Rows',
|
||||
'Avg_row_length',
|
||||
'Data_length',
|
||||
'Max_data_length',
|
||||
'Index_length',
|
||||
'Data_free',
|
||||
'Auto_increment',
|
||||
'Create_time',
|
||||
'Update_time',
|
||||
'Check_time',
|
||||
'Collation',
|
||||
'Checksum',
|
||||
'Create_options',
|
||||
'Comment',
|
||||
'Max_index_length',
|
||||
'Temporary',
|
||||
],
|
||||
'result' => [
|
||||
[
|
||||
'table1',
|
||||
'InnoDB',
|
||||
'10',
|
||||
'Dynamic',
|
||||
'4046',
|
||||
'101',
|
||||
'409600',
|
||||
'0',
|
||||
'114688',
|
||||
'0',
|
||||
'4080',
|
||||
'2020-07-03 17:24:47',
|
||||
null,
|
||||
null,
|
||||
'utf8mb4_general_ci',
|
||||
null,
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
'N',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'query' => 'SHOW TABLE STATUS FROM `world`',
|
||||
'columns' => [
|
||||
|
||||
@ -1537,7 +1537,7 @@ class TableTest extends AbstractTestCase
|
||||
$target_db = 'pma_test';
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tbl_object = new Table($target_db, $target_table, $dbi);
|
||||
$tbl_object = new Table($target_table, $target_db, $dbi);
|
||||
$tbl_object->getStatusInfo(null, true);
|
||||
$expect = 'DBIDUMMY';
|
||||
$tbl_storage_engine = $dbi->getTable($target_db, $target_table)->getStorageEngine();
|
||||
@ -1553,7 +1553,7 @@ class TableTest extends AbstractTestCase
|
||||
$target_db = 'pma_test';
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tbl_object = new Table($target_db, $target_table, $dbi);
|
||||
$tbl_object = new Table($target_table, $target_db, $dbi);
|
||||
$tbl_object->getStatusInfo(null, true);
|
||||
$expect = 'Test comment for "table1" in \'pma_test\'';
|
||||
$show_comment = $dbi->getTable($target_db, $target_table)->getComment();
|
||||
@ -1569,7 +1569,7 @@ class TableTest extends AbstractTestCase
|
||||
$target_db = 'pma_test';
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tbl_object = new Table($target_db, $target_table, $dbi);
|
||||
$tbl_object = new Table($target_table, $target_db, $dbi);
|
||||
$tbl_object->getStatusInfo(null, true);
|
||||
$expect = 'utf8mb4_general_ci';
|
||||
$tbl_collation = $dbi->getTable($target_db, $target_table)->getCollation();
|
||||
@ -1585,7 +1585,7 @@ class TableTest extends AbstractTestCase
|
||||
$target_db = 'pma_test';
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tbl_object = new Table($target_db, $target_table, $dbi);
|
||||
$tbl_object = new Table($target_table, $target_db, $dbi);
|
||||
$tbl_object->getStatusInfo(null, true);
|
||||
$expect = 'Redundant';
|
||||
$row_format = $dbi->getTable($target_db, $target_table)->getRowFormat();
|
||||
@ -1601,7 +1601,7 @@ class TableTest extends AbstractTestCase
|
||||
$target_db = 'pma_test';
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tbl_object = new Table($target_db, $target_table, $dbi);
|
||||
$tbl_object = new Table($target_table, $target_db, $dbi);
|
||||
$tbl_object->getStatusInfo(null, true);
|
||||
$expect = '5';
|
||||
$auto_increment = $dbi->getTable($target_db, $target_table)->getAutoIncrement();
|
||||
@ -1617,7 +1617,7 @@ class TableTest extends AbstractTestCase
|
||||
$target_db = 'pma_test';
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tbl_object = new Table($target_db, $target_table, $dbi);
|
||||
$tbl_object = new Table($target_table, $target_db, $dbi);
|
||||
$tbl_object->getStatusInfo(null, true);
|
||||
$expect = [
|
||||
'pack_keys' => 'DEFAULT',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user