diff --git a/src/Query/Generator.php b/src/Query/Generator.php index 4541280bb0..d924de551e 100644 --- a/src/Query/Generator.php +++ b/src/Query/Generator.php @@ -154,7 +154,8 @@ class Generator . ' = ' . $quotedDatabase . ' AND `TABLE_NAME` ' . Util::getCollateForIS() . ' = ' . $quotedTable - . ($quotedColumn !== null ? ' AND `COLUMN_NAME` = ' . $quotedColumn : ''); + . ($quotedColumn !== null ? ' AND `COLUMN_NAME` = ' . $quotedColumn : '') + . ' ORDER BY `ORDINAL_POSITION`'; } public static function getColumnNamesAndTypes( @@ -168,7 +169,8 @@ class Generator . ' WHERE `TABLE_SCHEMA` ' . Util::getCollateForIS() . ' = ' . $quotedDatabase . ' AND `TABLE_NAME` ' . Util::getCollateForIS() - . ' = ' . $quotedTable; + . ' = ' . $quotedTable + . ' ORDER BY `ORDINAL_POSITION`'; } public static function getInformationSchemaRoutinesRequest( diff --git a/tests/unit/ConfigStorage/RelationTest.php b/tests/unit/ConfigStorage/RelationTest.php index bde2494521..16c2dd9fdd 100644 --- a/tests/unit/ConfigStorage/RelationTest.php +++ b/tests/unit/ConfigStorage/RelationTest.php @@ -64,7 +64,8 @@ class RelationTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'information_schema\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'PMA\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'PMA\'' + . ' ORDER BY `ORDINAL_POSITION`', [], ); @@ -108,7 +109,8 @@ class RelationTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'information_schema\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'NON_EXISTING_TABLE\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'NON_EXISTING_TABLE\'' + . ' ORDER BY `ORDINAL_POSITION`', [], ); $db = 'information_schema'; diff --git a/tests/unit/Controllers/BrowseForeignersControllerTest.php b/tests/unit/Controllers/BrowseForeignersControllerTest.php index 06dd3e6d4e..706455024e 100644 --- a/tests/unit/Controllers/BrowseForeignersControllerTest.php +++ b/tests/unit/Controllers/BrowseForeignersControllerTest.php @@ -74,7 +74,8 @@ final class BrowseForeignersControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'\' AND `TABLE_NAME`' - . ' COLLATE utf8_bin = \'actor\'', + . ' COLLATE utf8_bin = \'actor\'' + . ' ORDER BY `ORDINAL_POSITION`', [ ['actor_id', 'smallint(5) unsigned', null, 'NO', 'PRI', null, 'auto_increment', '', ''], ['first_name', 'varchar(45)', null, 'NO', '', null, '', '', ''], diff --git a/tests/unit/Controllers/Import/ImportControllerTest.php b/tests/unit/Controllers/Import/ImportControllerTest.php index e04da97ab7..1eb07e90b2 100644 --- a/tests/unit/Controllers/Import/ImportControllerTest.php +++ b/tests/unit/Controllers/Import/ImportControllerTest.php @@ -85,7 +85,8 @@ class ImportControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'pma_test\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'table1\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'table1\'' + . ' ORDER BY `ORDINAL_POSITION`', [], ); diff --git a/tests/unit/Controllers/Sql/EnumValuesControllerTest.php b/tests/unit/Controllers/Sql/EnumValuesControllerTest.php index 023bc9b357..eeb499148b 100644 --- a/tests/unit/Controllers/Sql/EnumValuesControllerTest.php +++ b/tests/unit/Controllers/Sql/EnumValuesControllerTest.php @@ -45,7 +45,7 @@ class EnumValuesControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'cvv\' AND `TABLE_NAME`' - . ' COLLATE utf8_bin = \'enums\' AND `COLUMN_NAME` = \'set\'', false); + . ' COLLATE utf8_bin = \'enums\' AND `COLUMN_NAME` = \'set\' ORDER BY `ORDINAL_POSITION`', false); $this->dummyDbi->addResult('SHOW INDEXES FROM `cvv`.`enums`', false); Current::$database = 'cvv'; @@ -90,7 +90,8 @@ class EnumValuesControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'cvv\' AND `TABLE_NAME` COLLATE utf8_bin = \'enums\'' - . ' AND `COLUMN_NAME` = \'set\'', + . ' AND `COLUMN_NAME` = \'set\'' + . ' ORDER BY `ORDINAL_POSITION`', [ [ 'set', diff --git a/tests/unit/Controllers/Sql/SetValuesControllerTest.php b/tests/unit/Controllers/Sql/SetValuesControllerTest.php index 39c398ab8e..f38572cbf9 100644 --- a/tests/unit/Controllers/Sql/SetValuesControllerTest.php +++ b/tests/unit/Controllers/Sql/SetValuesControllerTest.php @@ -45,7 +45,7 @@ class SetValuesControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'cvv\' AND `TABLE_NAME`' - . ' COLLATE utf8_bin = \'enums\' AND `COLUMN_NAME` = \'set\'', false); + . ' COLLATE utf8_bin = \'enums\' AND `COLUMN_NAME` = \'set\' ORDER BY `ORDINAL_POSITION`', false); $this->dummyDbi->addResult('SHOW INDEXES FROM `cvv`.`enums`', false); $request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/') @@ -90,7 +90,8 @@ class SetValuesControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'cvv\' AND `TABLE_NAME` COLLATE utf8_bin = \'enums\'' - . ' AND `COLUMN_NAME` = \'set\'', + . ' AND `COLUMN_NAME` = \'set\'' + . ' ORDER BY `ORDINAL_POSITION`', [ [ 'set', diff --git a/tests/unit/Controllers/Table/CreateControllerTest.php b/tests/unit/Controllers/Table/CreateControllerTest.php index 597b07ee05..a17b70f7d0 100644 --- a/tests/unit/Controllers/Table/CreateControllerTest.php +++ b/tests/unit/Controllers/Table/CreateControllerTest.php @@ -40,7 +40,8 @@ class CreateControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'test_db\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'new_test_table\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'new_test_table\'' + . ' ORDER BY `ORDINAL_POSITION`', false, ); $dummyDbi->addResult( @@ -50,7 +51,8 @@ class CreateControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'test_db\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'new_test_table\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'new_test_table\'' + . ' ORDER BY `ORDINAL_POSITION`', false, ); $dummyDbi->addResult('SHOW CREATE TABLE `test_db`.`new_test_table`', false); diff --git a/tests/unit/Controllers/Table/GetFieldControllerTest.php b/tests/unit/Controllers/Table/GetFieldControllerTest.php index 61ec15bd3d..3ca9b93187 100644 --- a/tests/unit/Controllers/Table/GetFieldControllerTest.php +++ b/tests/unit/Controllers/Table/GetFieldControllerTest.php @@ -42,7 +42,8 @@ class GetFieldControllerTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'test_db\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'table_with_blob\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'table_with_blob\'' + . ' ORDER BY `ORDINAL_POSITION`', [ ['id', 'int(11)', null, 'NO', 'PRI', null, 'auto_increment', '', ''], ['file', 'blob', null, 'NO', '', null, '', '', ''], diff --git a/tests/unit/DatabaseInterfaceTest.php b/tests/unit/DatabaseInterfaceTest.php index 727b70ea20..57ac144f6a 100644 --- a/tests/unit/DatabaseInterfaceTest.php +++ b/tests/unit/DatabaseInterfaceTest.php @@ -865,7 +865,8 @@ class DatabaseInterfaceTest extends AbstractTestCase . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'test_db\' AND' . ' `TABLE_NAME` COLLATE utf8_bin = \'test_table\'' - . ' AND `COLUMN_NAME` = \'test_column\'', + . ' AND `COLUMN_NAME` = \'test_column\'' + . ' ORDER BY `ORDINAL_POSITION`', [['test_column', 'varchar(45)', null, 'NO', '', null, '', '', '']], ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], ); @@ -889,7 +890,8 @@ class DatabaseInterfaceTest extends AbstractTestCase . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'test_db\' AND' . ' `TABLE_NAME` COLLATE utf8_bin = \'test_table\'' - . ' AND `COLUMN_NAME` = \'test_column\'', + . ' AND `COLUMN_NAME` = \'test_column\'' + . ' ORDER BY `ORDINAL_POSITION`', // phpcs:ignore Generic.Files.LineLength.TooLong [['test_column', 'varchar(45)', 'utf8mb4_general_ci', 'NO', '', null, '', 'select,insert,update,references', '']], ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], diff --git a/tests/unit/Query/GeneratorTest.php b/tests/unit/Query/GeneratorTest.php index 8d451263d6..3ce339ab49 100644 --- a/tests/unit/Query/GeneratorTest.php +++ b/tests/unit/Query/GeneratorTest.php @@ -22,7 +22,8 @@ class GeneratorTest extends AbstractTestCase . ' `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` COLLATE utf8_bin = \'mydb\'' - . ' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\'', + . ' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\'' + . ' ORDER BY `ORDINAL_POSITION`', Generator::getColumns( "'mydb'", "'mytable'", @@ -33,7 +34,8 @@ class GeneratorTest extends AbstractTestCase . ' `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` COLLATE utf8_bin = \'mydb\'' - . ' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\' AND `COLUMN_NAME` = \'_idcolumn\'', + . ' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\' AND `COLUMN_NAME` = \'_idcolumn\'' + . ' ORDER BY `ORDINAL_POSITION`', Generator::getColumns( "'mydb'", "'mytable'", @@ -45,7 +47,8 @@ class GeneratorTest extends AbstractTestCase . ' `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` COLLATE utf8_bin = \'mydb\'' - . ' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\'', + . ' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\'' + . ' ORDER BY `ORDINAL_POSITION`', Generator::getColumns( "'mydb'", "'mytable'", @@ -57,7 +60,8 @@ class GeneratorTest extends AbstractTestCase . ' `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` COLLATE utf8_bin = \'mydb\'' - . ' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\' AND `COLUMN_NAME` = \'_idcolumn\'', + . ' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\' AND `COLUMN_NAME` = \'_idcolumn\'' + . ' ORDER BY `ORDINAL_POSITION`', Generator::getColumns( "'mydb'", "'mytable'", diff --git a/tests/unit/SqlTest.php b/tests/unit/SqlTest.php index 63cd2b8a3e..25f1d776e2 100644 --- a/tests/unit/SqlTest.php +++ b/tests/unit/SqlTest.php @@ -544,7 +544,8 @@ class SqlTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'sakila\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'country\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'country\'' + . ' ORDER BY `ORDINAL_POSITION`', [ [ 'country_id', @@ -589,7 +590,8 @@ class SqlTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'sakila\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'country\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'country\'' + . ' ORDER BY `ORDINAL_POSITION`', [ ['country_id', 'smallint(5) unsigned', null, 'NO', 'PRI', null, 'auto_increment', '', ''], ['country', 'varchar(50)', null, 'NO', '', null, '', '', ''], diff --git a/tests/unit/Stubs/DbiDummy.php b/tests/unit/Stubs/DbiDummy.php index 9b24c4867c..c75f01523f 100644 --- a/tests/unit/Stubs/DbiDummy.php +++ b/tests/unit/Stubs/DbiDummy.php @@ -446,7 +446,7 @@ class DbiDummy implements DbiExtension . ' `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` COLLATE utf8_bin = \'pma_test\' AND `TABLE_NAME` COLLATE utf8_bin = \'table1\'', + . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'pma_test\' AND `TABLE_NAME` COLLATE utf8_bin = \'table1\' ORDER BY `ORDINAL_POSITION`', 'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], 'result' => [ ['i', 'int(11)', null, 'NO', 'PRI', 'NULL', 'auto_increment', '', ''], @@ -459,7 +459,7 @@ class DbiDummy implements DbiExtension . ' `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` COLLATE utf8_bin = \'pma_test\' AND `TABLE_NAME` COLLATE utf8_bin = \'table2\'', + . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'pma_test\' AND `TABLE_NAME` COLLATE utf8_bin = \'table2\' ORDER BY `ORDINAL_POSITION`', 'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], 'result' => [ ['i', 'int(11)', null, 'NO', 'PRI', 'NULL', 'auto_increment', '', ''], @@ -473,7 +473,7 @@ class DbiDummy implements DbiExtension . ' `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` COLLATE utf8_bin = \'pma\' AND `TABLE_NAME` COLLATE utf8_bin = \'table1\'', + . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'pma\' AND `TABLE_NAME` COLLATE utf8_bin = \'table1\' ORDER BY `ORDINAL_POSITION`', 'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], 'result' => [ ['i', 'int(11)', null, 'NO', 'PRI', 'NULL', 'auto_increment', '', ''], @@ -1333,7 +1333,7 @@ class DbiDummy implements DbiExtension . ' `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'", + . " WHERE `TABLE_SCHEMA` = 'information_schema' AND `TABLE_NAME` = 'PMA' ORDER BY `ORDINAL_POSITION`", 'result' => [], ], [ @@ -1363,7 +1363,7 @@ class DbiDummy implements DbiExtension . ' `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` COLLATE utf8_bin = \'my_db\' AND `TABLE_NAME` COLLATE utf8_bin = \'test_tbl\'', + . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'my_db\' AND `TABLE_NAME` COLLATE utf8_bin = \'test_tbl\' ORDER BY `ORDINAL_POSITION`', 'result' => [], ], [ @@ -1385,7 +1385,7 @@ class DbiDummy implements DbiExtension . ' `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` COLLATE utf8_bin = \'PMA_db\' AND `TABLE_NAME` COLLATE utf8_bin = \'PMA_table\'', + . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'PMA_db\' AND `TABLE_NAME` COLLATE utf8_bin = \'PMA_table\' ORDER BY `ORDINAL_POSITION`', 'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], 'result' => [ ['id', 'int(11)', null, 'NO', 'PRI', null, 'auto_increment', '', ''], @@ -1499,7 +1499,7 @@ class DbiDummy implements DbiExtension . ' `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` COLLATE utf8_bin = \'mysql\' AND `TABLE_NAME` COLLATE utf8_bin = \'user\'', + . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'mysql\' AND `TABLE_NAME` COLLATE utf8_bin = \'user\' ORDER BY `ORDINAL_POSITION`', 'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], 'result' => [['host', 'char(60)', null, 'NO', '', null, '', '', '']], ], @@ -1626,7 +1626,7 @@ class DbiDummy implements DbiExtension . ' `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` COLLATE utf8_bin = \'testdb\' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\'', + . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'testdb\' AND `TABLE_NAME` COLLATE utf8_bin = \'mytable\' ORDER BY `ORDINAL_POSITION`', 'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], 'result' => [ ['aid', 'tinyint(4)', null, 'NO', 'PRI', null, '', 'select,insert,update,references', ''], @@ -1664,7 +1664,7 @@ class DbiDummy implements DbiExtension ], ], [ - 'query' => 'SELECT `COLUMN_NAME`, `COLUMN_TYPE` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'test_db\' AND `TABLE_NAME` COLLATE utf8_bin = \'test_table\'', + 'query' => 'SELECT `COLUMN_NAME`, `COLUMN_TYPE` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'test_db\' AND `TABLE_NAME` COLLATE utf8_bin = \'test_table\' ORDER BY `ORDINAL_POSITION`', 'columns' => ['COLUMN_NAME', 'COLUMN_TYPE'], 'result' => [ ['id', 'int(11)'], @@ -1686,7 +1686,7 @@ class DbiDummy implements DbiExtension . ' `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` COLLATE utf8_bin = \'test_db\' AND `TABLE_NAME` COLLATE utf8_bin = \'test_table\'', + . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'test_db\' AND `TABLE_NAME` COLLATE utf8_bin = \'test_table\' ORDER BY `ORDINAL_POSITION`', 'columns' => ['Field', 'Type', 'Collation', 'Null', 'Key', 'Default', 'Extra', 'Privileges', 'Comment'], 'result' => [ ['id', 'int(11)', null, 'NO', 'PRI', "'NULL'", 'auto_increment', '', ''], diff --git a/tests/unit/Table/ColumnsDefinitionTest.php b/tests/unit/Table/ColumnsDefinitionTest.php index 026d3f7010..cc4b652fc4 100644 --- a/tests/unit/Table/ColumnsDefinitionTest.php +++ b/tests/unit/Table/ColumnsDefinitionTest.php @@ -39,7 +39,8 @@ class ColumnsDefinitionTest extends AbstractTestCase . ' `COLUMN_COMMENT` AS `Comment`' . ' FROM `information_schema`.`COLUMNS`' . ' WHERE `TABLE_SCHEMA` COLLATE utf8_bin = \'sakila\' AND' - . ' `TABLE_NAME` COLLATE utf8_bin = \'actor\'', + . ' `TABLE_NAME` COLLATE utf8_bin = \'actor\'' + . ' ORDER BY `ORDINAL_POSITION`', [ ['actor_id', 'smallint(5) unsigned', null, 'NO', 'PRI', null, 'auto_increment', 'select,insert,update,references', ''], ['first_name', 'varchar(45)', 'utf8mb4_general_ci', 'NO', '', null, '', 'select,insert,update,references', ''],