Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
b9fec6be
Unverified
Commit
b9fec6be
authored
Jun 08, 2018
by
Sergei Morozov
Committed by
GitHub
Jun 08, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3128 from mlocati/mysql8-keywords
Add MySQL 8 reserved keywords
parents
fafac8da
3805b2ba
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
134 additions
and
2 deletions
+134
-2
platforms.rst
docs/en/reference/platforms.rst
+1
-0
AbstractMySQLDriver.php
lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
+9
-2
MySQL80Keywords.php
lib/Doctrine/DBAL/Platforms/Keywords/MySQL80Keywords.php
+81
-0
MySQL80Platform.php
lib/Doctrine/DBAL/Platforms/MySQL80Platform.php
+36
-0
ReservedWordsCommand.php
...trine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
+3
-0
AbstractMySQLDriverTest.php
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
+4
-0
No files found.
docs/en/reference/platforms.rst
View file @
b9fec6be
...
@@ -35,6 +35,7 @@ MySQL
...
@@ -35,6 +35,7 @@ MySQL
- ``MySqlPlatform`` for version 5.0 and above.
- ``MySqlPlatform`` for version 5.0 and above.
- ``MySQL57Platform`` for version 5.7 (5.7.9 GA) and above.
- ``MySQL57Platform`` for version 5.7 (5.7.9 GA) and above.
- ``MySQL80Platform`` for version 8.0 (8.0 GA) and above.
Oracle
Oracle
^^^^^^
^^^^^^
...
...
lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
View file @
b9fec6be
...
@@ -24,6 +24,7 @@ use Doctrine\DBAL\Driver;
...
@@ -24,6 +24,7 @@ use Doctrine\DBAL\Driver;
use
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\Platforms\MariaDb1027Platform
;
use
Doctrine\DBAL\Platforms\MariaDb1027Platform
;
use
Doctrine\DBAL\Platforms\MySQL57Platform
;
use
Doctrine\DBAL\Platforms\MySQL57Platform
;
use
Doctrine\DBAL\Platforms\MySQL80Platform
;
use
Doctrine\DBAL\Platforms\MySqlPlatform
;
use
Doctrine\DBAL\Platforms\MySqlPlatform
;
use
Doctrine\DBAL\Schema\MySqlSchemaManager
;
use
Doctrine\DBAL\Schema\MySqlSchemaManager
;
use
Doctrine\DBAL\VersionAwarePlatformDriver
;
use
Doctrine\DBAL\VersionAwarePlatformDriver
;
...
@@ -137,8 +138,14 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
...
@@ -137,8 +138,14 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
return
new
MariaDb1027Platform
();
return
new
MariaDb1027Platform
();
}
}
if
(
!
$mariadb
&&
version_compare
(
$this
->
getOracleMysqlVersionNumber
(
$version
),
'5.7.9'
,
'>='
))
{
if
(
!
$mariadb
)
{
return
new
MySQL57Platform
();
$oracleMysqlVersion
=
$this
->
getOracleMysqlVersionNumber
(
$version
);
if
(
version_compare
(
$oracleMysqlVersion
,
'8'
,
'>='
))
{
return
new
MySQL80Platform
();
}
if
(
version_compare
(
$oracleMysqlVersion
,
'5.7.9'
,
'>='
))
{
return
new
MySQL57Platform
();
}
}
}
return
$this
->
getDatabasePlatform
();
return
$this
->
getDatabasePlatform
();
...
...
lib/Doctrine/DBAL/Platforms/Keywords/MySQL80Keywords.php
0 → 100644
View file @
b9fec6be
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Platforms\Keywords
;
use
function
array_merge
;
/**
* MySQL 8.0 reserved keywords list.
*
* @link www.doctrine-project.org
*/
class
MySQL80Keywords
extends
MySQL57Keywords
{
/**
* {@inheritdoc}
*/
public
function
getName
()
{
return
'MySQL80'
;
}
/**
* {@inheritdoc}
*
* @link https://dev.mysql.com/doc/refman/8.0/en/keywords.html
*/
protected
function
getKeywords
()
{
$keywords
=
parent
::
getKeywords
();
$keywords
=
array_merge
(
$keywords
,
[
'ADMIN'
,
'CUBE'
,
'CUME_DIST'
,
'DENSE_RANK'
,
'EMPTY'
,
'EXCEPT'
,
'FIRST_VALUE'
,
'FUNCTION'
,
'GROUPING'
,
'GROUPS'
,
'JSON_TABLE'
,
'LAG'
,
'LAST_VALUE'
,
'LEAD'
,
'NTH_VALUE'
,
'NTILE'
,
'OF'
,
'OVER'
,
'PERCENT_RANK'
,
'PERSIST'
,
'PERSIST_ONLY'
,
'RANK'
,
'RECURSIVE'
,
'ROW'
,
'ROWS'
,
'ROW_NUMBER'
,
'SYSTEM'
,
'WINDOW'
,
]);
return
$keywords
;
}
}
lib/Doctrine/DBAL/Platforms/MySQL80Platform.php
0 → 100644
View file @
b9fec6be
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Platforms
;
/**
* Provides the behavior, features and SQL dialect of the MySQL 8.0 (8.0 GA) database platform.
*
* @link www.doctrine-project.org
*/
class
MySQL80Platform
extends
MySQL57Platform
{
/**
* {@inheritdoc}
*/
protected
function
getReservedKeywordsClass
()
{
return
Keywords\MySQL80Keywords
::
class
;
}
}
lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
View file @
b9fec6be
...
@@ -36,6 +36,7 @@ class ReservedWordsCommand extends Command
...
@@ -36,6 +36,7 @@ class ReservedWordsCommand extends Command
private
$keywordListClasses
=
[
private
$keywordListClasses
=
[
'mysql'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords'
,
'mysql'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords'
,
'mysql57'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords'
,
'mysql57'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords'
,
'mysql80'
=>
'Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords'
,
'sqlserver'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords'
,
'sqlserver'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords'
,
'sqlserver2005'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords'
,
'sqlserver2005'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords'
,
'sqlserver2008'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords'
,
'sqlserver2008'
=>
'Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords'
,
...
@@ -96,6 +97,7 @@ The following keyword lists are currently shipped with Doctrine:
...
@@ -96,6 +97,7 @@ The following keyword lists are currently shipped with Doctrine:
* mysql
* mysql
* mysql57
* mysql57
* mysql80
* pgsql
* pgsql
* pgsql92
* pgsql92
* sqlite
* sqlite
...
@@ -126,6 +128,7 @@ EOT
...
@@ -126,6 +128,7 @@ EOT
$keywordLists
=
[
$keywordLists
=
[
'mysql'
,
'mysql'
,
'mysql57'
,
'mysql57'
,
'mysql80'
,
'pgsql'
,
'pgsql'
,
'pgsql92'
,
'pgsql92'
,
'sqlite'
,
'sqlite'
,
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
View file @
b9fec6be
...
@@ -5,6 +5,7 @@ namespace Doctrine\Tests\DBAL\Driver;
...
@@ -5,6 +5,7 @@ namespace Doctrine\Tests\DBAL\Driver;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Platforms\MariaDb1027Platform
;
use
Doctrine\DBAL\Platforms\MariaDb1027Platform
;
use
Doctrine\DBAL\Platforms\MySQL57Platform
;
use
Doctrine\DBAL\Platforms\MySQL57Platform
;
use
Doctrine\DBAL\Platforms\MySQL80Platform
;
use
Doctrine\DBAL\Platforms\MySqlPlatform
;
use
Doctrine\DBAL\Platforms\MySqlPlatform
;
use
Doctrine\DBAL\Schema\MySqlSchemaManager
;
use
Doctrine\DBAL\Schema\MySqlSchemaManager
;
...
@@ -63,6 +64,9 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
...
@@ -63,6 +64,9 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
[
'5.7.8'
,
MySqlPlatform
::
class
],
[
'5.7.8'
,
MySqlPlatform
::
class
],
[
'5.7.9'
,
MySQL57Platform
::
class
],
[
'5.7.9'
,
MySQL57Platform
::
class
],
[
'5.7.10'
,
MySQL57Platform
::
class
],
[
'5.7.10'
,
MySQL57Platform
::
class
],
[
'8'
,
MySQL80Platform
::
class
],
[
'8.0'
,
MySQL80Platform
::
class
],
[
'8.0.11'
,
MySQL80Platform
::
class
],
[
'6'
,
MySQL57Platform
::
class
],
[
'6'
,
MySQL57Platform
::
class
],
[
'10.0.15-MariaDB-1~wheezy'
,
MySqlPlatform
::
class
],
[
'10.0.15-MariaDB-1~wheezy'
,
MySqlPlatform
::
class
],
[
'5.5.5-10.1.25-MariaDB'
,
MySqlPlatform
::
class
],
[
'5.5.5-10.1.25-MariaDB'
,
MySqlPlatform
::
class
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment