File tree Expand file tree Collapse file tree 6 files changed +107
-1
lines changed Expand file tree Collapse file tree 6 files changed +107
-1
lines changed Original file line number Diff line number Diff line change 1313use Doctrine \DBAL \Platforms \MariaDb1043Platform ;
1414use Doctrine \DBAL \Platforms \MariaDb1052Platform ;
1515use Doctrine \DBAL \Platforms \MariaDb1060Platform ;
16+ use Doctrine \DBAL \Platforms \MariaDb110700Platform ;
1617use Doctrine \DBAL \Platforms \MySQL57Platform ;
1718use Doctrine \DBAL \Platforms \MySQL80Platform ;
1819use Doctrine \DBAL \Platforms \MySQL84Platform ;
@@ -42,6 +43,10 @@ public function createDatabasePlatformForVersion($version)
4243
4344 if ($ mariadb ) {
4445 $ mariaDbVersion = $ this ->getMariaDbMysqlVersionNumber ($ version );
46+ if (version_compare ($ mariaDbVersion , '11.7.0 ' , '>= ' )) {
47+ return new MariaDb110700Platform ();
48+ }
49+
4550 if (version_compare ($ mariaDbVersion , '10.10.0 ' , '>= ' )) {
4651 return new MariaDb1010Platform ();
4752 }
Original file line number Diff line number Diff line change 1111 *
1212 * @link https://mariadb.com/kb/en/the-mariadb-library/reserved-words/
1313 */
14- final class MariaDb102Keywords extends MariaDBKeywords
14+ class MariaDb102Keywords extends MariaDBKeywords
1515{
1616 /** @deprecated */
1717 public function getName (): string
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Doctrine \DBAL \Platforms \Keywords ;
6+
7+ use Doctrine \Deprecations \Deprecation ;
8+
9+ use function array_merge ;
10+
11+ /**
12+ * MariaDB 11.7 reserved keywords list.
13+ */
14+ class MariaDb117Keywords extends MariaDb102Keywords
15+ {
16+ /**
17+ * {@inheritDoc}
18+ *
19+ * @deprecated
20+ */
21+ public function getName (): string
22+ {
23+ Deprecation::triggerIfCalledFromOutside (
24+ 'doctrine/dbal ' ,
25+ 'https://github.com/doctrine/dbal/pull/5433 ' ,
26+ 'MariaDb117Keywords::getName() is deprecated. ' ,
27+ );
28+
29+ return 'MariaDb117 ' ;
30+ }
31+
32+ /**
33+ * {@inheritDoc}
34+ *
35+ * @link https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/reserved-words
36+ */
37+ protected function getKeywords (): array
38+ {
39+ $ keywords = parent ::getKeywords ();
40+
41+ // New Keywords and Reserved Words
42+ $ keywords = array_merge ($ keywords , ['VECTOR ' ]);
43+
44+ return $ keywords ;
45+ }
46+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Doctrine \DBAL \Platforms ;
6+
7+ use Doctrine \Deprecations \Deprecation ;
8+
9+ /**
10+ * Provides the behavior, features and SQL dialect of the MariaDB 11.7 database platform.
11+ */
12+ class MariaDb110700Platform extends MariaDb1010Platform
13+ {
14+ /** @deprecated Implement {@see createReservedKeywordsList()} instead. */
15+ protected function getReservedKeywordsClass (): string
16+ {
17+ Deprecation::triggerIfCalledFromOutside (
18+ 'doctrine/dbal ' ,
19+ 'https://github.com/doctrine/dbal/issues/4510 ' ,
20+ 'MariaDb110700Platform::getReservedKeywordsClass() is deprecated, '
21+ . ' use MariaDb110700Platform::createReservedKeywordsList() instead. ' ,
22+ );
23+
24+ return Keywords \MariaDb117Keywords::class;
25+ }
26+ }
Original file line number Diff line number Diff line change 77use Doctrine \DBAL \Platforms \Keywords \DB2Keywords ;
88use Doctrine \DBAL \Platforms \Keywords \KeywordList ;
99use Doctrine \DBAL \Platforms \Keywords \MariaDb102Keywords ;
10+ use Doctrine \DBAL \Platforms \Keywords \MariaDb117Keywords ;
1011use Doctrine \DBAL \Platforms \Keywords \MySQL57Keywords ;
1112use Doctrine \DBAL \Platforms \Keywords \MySQL80Keywords ;
1213use Doctrine \DBAL \Platforms \Keywords \MySQL84Keywords ;
@@ -57,6 +58,7 @@ public function __construct(ConnectionProvider $connectionProvider)
5758 $ this ->keywordLists = [
5859 'db2 ' => new DB2Keywords (),
5960 'mariadb102 ' => new MariaDb102Keywords (),
61+ 'mariadb117 ' => new MariaDb117Keywords (),
6062 'mysql ' => new MySQLKeywords (),
6163 'mysql57 ' => new MySQL57Keywords (),
6264 'mysql80 ' => new MySQL80Keywords (),
@@ -128,6 +130,7 @@ private function doConfigure(): void
128130
129131 * db2
130132 * mariadb102
133+ * mariadb117
131134 * mysql
132135 * mysql57
133136 * mysql80
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Doctrine \DBAL \Tests \Platforms ;
6+
7+ use Doctrine \DBAL \Platforms \AbstractPlatform ;
8+ use Doctrine \DBAL \Platforms \Keywords \KeywordList ;
9+ use Doctrine \DBAL \Platforms \MariaDb110700Platform ;
10+
11+ class MariaDb110700PlatformTest extends MariaDb1052PlatformTest
12+ {
13+ public function createPlatform (): AbstractPlatform
14+ {
15+ return new MariaDb110700Platform ();
16+ }
17+
18+ public function testMariaDb117KeywordList (): void
19+ {
20+ $ keywordList = $ this ->platform ->getReservedKeywordsList ();
21+ self ::assertInstanceOf (KeywordList::class, $ keywordList );
22+
23+ self ::assertTrue ($ keywordList ->isKeyword ('vector ' ));
24+ self ::assertTrue ($ keywordList ->isKeyword ('distinctrow ' ));
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments