Skip to content

Commit 002a4d9

Browse files
committed
Merge branch '3.9.x' into 4.1.x
* 3.9.x: MySQL 8.4 Platform (doctrine#6385)
2 parents 22f1d3a + 8141266 commit 002a4d9

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
@@ -13,6 +13,7 @@
1313
use Doctrine\DBAL\Platforms\MariaDB1060Platform;
1414
use Doctrine\DBAL\Platforms\MariaDBPlatform;
1515
use Doctrine\DBAL\Platforms\MySQL80Platform;
16+
use Doctrine\DBAL\Platforms\MySQL84Platform;
1617
use Doctrine\DBAL\Platforms\MySQLPlatform;
1718
use Doctrine\DBAL\ServerVersionProvider;
1819
use Doctrine\Deprecations\Deprecation;
@@ -53,6 +54,10 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Abs
5354
return new MariaDBPlatform();
5455
}
5556

57+
if (version_compare($version, '8.4.0', '>=')) {
58+
return new MySQL84Platform();
59+
}
60+
5661
if (version_compare($version, '8.0.0', '>=')) {
5762
return new MySQL80Platform();
5863
}
+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 MySQL80Keywords
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 MySQL80Platform
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
@@ -11,6 +11,7 @@
1111
use Doctrine\DBAL\Platforms\MariaDB1060Platform;
1212
use Doctrine\DBAL\Platforms\MariaDBPlatform;
1313
use Doctrine\DBAL\Platforms\MySQL80Platform;
14+
use Doctrine\DBAL\Platforms\MySQL84Platform;
1415
use Doctrine\DBAL\Platforms\MySQLPlatform;
1516
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1617
use PHPUnit\Framework\Attributes\DataProvider;
@@ -36,6 +37,7 @@ public static function mySQLVersionProvider(): array
3637
return [
3738
['5.7.0', MySQLPlatform::class],
3839
['8.0.11', MySQL80Platform::class],
40+
['8.4.0', MySQL84Platform::class],
3941
['5.5.40-MariaDB-1~wheezy', MariaDBPlatform::class],
4042
['5.5.5-MariaDB-10.2.8+maria~xenial-log', MariaDBPlatform::class],
4143
['10.2.8-MariaDB-10.2.8+maria~xenial-log', MariaDBPlatform::class],

0 commit comments

Comments
 (0)