Skip to content

Commit 8c43133

Browse files
committed
Merge branch '4.1.x' into 5.0.x
* 4.1.x: MySQL 8.4 Platform (doctrine#6385)
2 parents 5433383 + 002a4d9 commit 8c43133

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

docs/en/reference/platforms.rst

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ MySQL
3535

3636
- ``MySQLPlatform`` for version 5.7 (5.7.9 GA) and above.
3737
- ``MySQL80Platform`` for version 8.0 (8.0 GA) and above.
38+
- ``MySQL84Platform`` for version 8.4 (8.4 GA) and above.
3839

3940
MariaDB
4041
^^^^^

src/Driver/AbstractMySQLDriver.php

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Doctrine\DBAL\Platforms\Exception\InvalidPlatformVersion;
1212
use Doctrine\DBAL\Platforms\MariaDB1060Platform;
1313
use Doctrine\DBAL\Platforms\MariaDBPlatform;
14+
use Doctrine\DBAL\Platforms\MySQL84Platform;
1415
use Doctrine\DBAL\Platforms\MySQLPlatform;
1516
use Doctrine\DBAL\ServerVersionProvider;
1617

@@ -40,6 +41,10 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Abs
4041
return new MariaDBPlatform();
4142
}
4243

44+
if (version_compare($version, '8.4.0', '>=')) {
45+
return new MySQL84Platform();
46+
}
47+
4348
return new MySQLPlatform();
4449
}
4550

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Doctrine\DBAL\Platforms\Keywords;
6+
7+
use function array_merge;
8+
9+
/**
10+
* MySQL 8.4 reserved keywords list.
11+
*/
12+
class MySQL84Keywords extends MySQLKeywords
13+
{
14+
/**
15+
* {@inheritDoc}
16+
*
17+
* @link https://dev.mysql.com/doc/refman/8.4/en/keywords.html#keywords-new-in-current-series
18+
*/
19+
protected function getKeywords(): array
20+
{
21+
$keywords = parent::getKeywords();
22+
23+
$keywords = array_merge($keywords, [
24+
'AUTO',
25+
'BERNOULLI',
26+
'GTIDS',
27+
'LOG',
28+
'MANUAL',
29+
'PARALLEL',
30+
'PARSE_TREE',
31+
'QUALIFY',
32+
'S3',
33+
'TABLESAMPLE',
34+
]);
35+
36+
return $keywords;
37+
}
38+
}

src/Platforms/MySQL84Platform.php

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Doctrine\DBAL\Platforms;
6+
7+
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
8+
use Doctrine\DBAL\Platforms\Keywords\MySQL84Keywords;
9+
10+
/**
11+
* Provides the behavior, features and SQL dialect of the MySQL 8.4 (8.4 GA) database platform.
12+
*/
13+
class MySQL84Platform extends MySQLPlatform
14+
{
15+
protected function createReservedKeywordsList(): KeywordList
16+
{
17+
return new MySQL84Keywords();
18+
}
19+
}

tests/Driver/VersionAwarePlatformDriverTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Doctrine\DBAL\Platforms\AbstractPlatform;
1010
use Doctrine\DBAL\Platforms\MariaDB1060Platform;
1111
use Doctrine\DBAL\Platforms\MariaDBPlatform;
12+
use Doctrine\DBAL\Platforms\MySQL84Platform;
1213
use Doctrine\DBAL\Platforms\MySQLPlatform;
1314
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1415
use PHPUnit\Framework\Attributes\DataProvider;
@@ -33,6 +34,7 @@ public static function mySQLVersionProvider(): array
3334
{
3435
return [
3536
['8.0.11', MySQLPlatform::class],
37+
['8.4.0', MySQL84Platform::class],
3638
['5.5.40-MariaDB-1~wheezy', MariaDBPlatform::class],
3739
['5.5.5-MariaDB-10.2.8+maria~xenial-log', MariaDBPlatform::class],
3840
['10.2.8-MariaDB-10.2.8+maria~xenial-log', MariaDBPlatform::class],

0 commit comments

Comments
 (0)