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
e98d2416
Commit
e98d2416
authored
May 09, 2017
by
Marco Pivetta
Committed by
GitHub
May 09, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2653 from deeky666/fix-mysql57-platform
Merge MySQL 5.7.9 (GA) semantics into MySQL57Platform
parents
3632e03c
f4381c58
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
8 deletions
+61
-8
platforms.rst
docs/en/reference/platforms.rst
+1
-1
AbstractMySQLDriver.php
lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
+8
-3
MySQL57Keywords.php
lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php
+4
-1
MySQL57Platform.php
lib/Doctrine/DBAL/Platforms/MySQL57Platform.php
+28
-1
AbstractMySQLDriverTest.php
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
+4
-2
MySQL57PlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php
+16
-0
No files found.
docs/en/reference/platforms.rst
View file @
e98d2416
...
...
@@ -34,7 +34,7 @@ MySQL
^^^^^
- ``MySqlPlatform`` for version 5.0 and above.
- ``MySQL57Platform`` for version 5.7 and above.
- ``MySQL57Platform`` for version 5.7
(5.7.9 GA)
and above.
Oracle
^^^^^^
...
...
lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
View file @
e98d2416
...
...
@@ -138,10 +138,15 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
$majorVersion
=
$versionParts
[
'major'
];
$minorVersion
=
isset
(
$versionParts
[
'minor'
])
?
$versionParts
[
'minor'
]
:
0
;
$patchVersion
=
isset
(
$versionParts
[
'patch'
])
?
$versionParts
[
'patch'
]
:
0
;
$version
=
$majorVersion
.
'.'
.
$minorVersion
.
'.'
.
$patchVersion
;
$patchVersion
=
isset
(
$versionParts
[
'patch'
])
?
$versionParts
[
'patch'
]
:
null
;
if
(
version_compare
(
$version
,
'5.7'
,
'>='
))
{
if
(
'5'
===
$majorVersion
&&
'7'
===
$minorVersion
&&
null
===
$patchVersion
)
{
$patchVersion
=
'9'
;
}
$version
=
$majorVersion
.
'.'
.
$minorVersion
.
'.'
.
$patchVersion
;
if
(
version_compare
(
$version
,
'5.7.9'
,
'>='
))
{
return
new
MySQL57Platform
();
}
...
...
lib/Doctrine/DBAL/Platforms/Keywords/MySQL57Keywords.php
View file @
e98d2416
...
...
@@ -119,6 +119,7 @@ class MySQL57Keywords extends MySQLKeywords
'FOREIGN'
,
'FROM'
,
'FULLTEXT'
,
'GENERATED'
,
'GET'
,
'GRANT'
,
'GROUP'
,
...
...
@@ -183,12 +184,12 @@ class MySQL57Keywords extends MySQLKeywords
'MODIFIES'
,
'NATURAL'
,
'NO_WRITE_TO_BINLOG'
,
'NONBLOCKING'
,
'NOT'
,
'NULL'
,
'NUMERIC'
,
'ON'
,
'OPTIMIZE'
,
'OPTIMIZER_COSTS'
,
'OPTION'
,
'OPTIONALLY'
,
'OR'
,
...
...
@@ -240,6 +241,7 @@ class MySQL57Keywords extends MySQLKeywords
'SQLWARNING'
,
'SSL'
,
'STARTING'
,
'STORED'
,
'STRAIGHT_JOIN'
,
'TABLE'
,
'TERMINATED'
,
...
...
@@ -268,6 +270,7 @@ class MySQL57Keywords extends MySQLKeywords
'VARCHAR'
,
'VARCHARACTER'
,
'VARYING'
,
'VIRTUAL'
,
'WHEN'
,
'WHERE'
,
'WHILE'
,
...
...
lib/Doctrine/DBAL/Platforms/MySQL57Platform.php
View file @
e98d2416
...
...
@@ -23,14 +23,31 @@ use Doctrine\DBAL\Schema\Index;
use
Doctrine\DBAL\Schema\TableDiff
;
/**
* Provides the behavior, features and SQL dialect of the MySQL 5.7 database platform.
* Provides the behavior, features and SQL dialect of the MySQL 5.7
(5.7.9 GA)
database platform.
*
* @author İsmail BASKIN <ismailbaskin1@gmail.com>
* @author Steve Müller <st.mueller@dzh-online.de>
* @link www.doctrine-project.org
* @since 2.5
*/
class
MySQL57Platform
extends
MySqlPlatform
{
/**
* {@inheritdoc}
*/
public
function
hasNativeJsonType
()
{
return
true
;
}
/**
* {@inheritdoc}
*/
public
function
getJsonTypeDeclarationSQL
(
array
$field
)
{
return
'JSON'
;
}
/**
* {@inheritdoc}
*/
...
...
@@ -64,4 +81,14 @@ class MySQL57Platform extends MySqlPlatform
{
return
'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords'
;
}
/**
* {@inheritdoc}
*/
protected
function
initializeDoctrineTypeMappings
()
{
parent
::
initializeDoctrineTypeMappings
();
$this
->
doctrineTypeMapping
[
'json'
]
=
'json_array'
;
}
}
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
View file @
e98d2416
...
...
@@ -57,8 +57,10 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
return
array
(
array
(
'5.6.9'
,
'Doctrine\DBAL\Platforms\MySqlPlatform'
),
array
(
'5.7'
,
'Doctrine\DBAL\Platforms\MySQL57Platform'
),
array
(
'5.7.0'
,
'Doctrine\DBAL\Platforms\MySQL57Platform'
),
array
(
'5.7.1'
,
'Doctrine\DBAL\Platforms\MySQL57Platform'
),
array
(
'5.7.0'
,
'Doctrine\DBAL\Platforms\MySqlPlatform'
),
array
(
'5.7.8'
,
'Doctrine\DBAL\Platforms\MySqlPlatform'
),
array
(
'5.7.9'
,
'Doctrine\DBAL\Platforms\MySQL57Platform'
),
array
(
'5.7.10'
,
'Doctrine\DBAL\Platforms\MySQL57Platform'
),
array
(
'6'
,
'Doctrine\DBAL\Platforms\MySQL57Platform'
),
array
(
'10.0.15-MariaDB-1~wheezy'
,
'Doctrine\DBAL\Platforms\MySqlPlatform'
),
array
(
'10.1.2a-MariaDB-a1~lenny-log'
,
'Doctrine\DBAL\Platforms\MySqlPlatform'
),
...
...
tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php
View file @
e98d2416
...
...
@@ -14,6 +14,22 @@ class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase
return
new
MySQL57Platform
();
}
public
function
testHasNativeJsonType
()
{
$this
->
assertTrue
(
$this
->
_platform
->
hasNativeJsonType
());
}
public
function
testReturnsJsonTypeDeclarationSQL
()
{
$this
->
assertSame
(
'JSON'
,
$this
->
_platform
->
getJsonTypeDeclarationSQL
(
array
()));
}
public
function
testInitializesJsonTypeMapping
()
{
$this
->
assertTrue
(
$this
->
_platform
->
hasDoctrineTypeMappingFor
(
'json'
));
$this
->
assertSame
(
'json_array'
,
$this
->
_platform
->
getDoctrineTypeMapping
(
'json'
));
}
/**
* @group DBAL-234
*/
...
...
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