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
4747fd0c
Unverified
Commit
4747fd0c
authored
Oct 13, 2017
by
belgattitude
Committed by
Luís Cobucci
Nov 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Latest reviews fixes: morozov, Majkl578
parent
5422bae0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
80 deletions
+35
-80
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+2
-2
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+2
-2
AbstractMySQLDriverTest.php
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
+18
-18
DriverTest.php
...Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php
+6
-6
AbstractMySQLPlatformTestCase.php
...ne/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
+0
-15
AbstractPostgreSqlPlatformTestCase.php
...sts/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
+0
-15
MariaDb1027PlatformTest.php
...Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php
+7
-7
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+0
-15
No files found.
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
4747fd0c
...
...
@@ -477,7 +477,7 @@ class MySqlPlatform extends AbstractPlatform
public
function
getDefaultValueDeclarationSQL
(
$field
)
{
// Unset the default value if the given field type does not allow default values.
if
(
!
$this
->
isDefaultValueSupportedForType
(
$field
[
'type'
]))
{
if
(
!
$this
->
isDefaultValueSupportedForType
(
$field
[
'type'
]))
{
$field
[
'default'
]
=
null
;
}
...
...
@@ -595,7 +595,7 @@ class MySqlPlatform extends AbstractPlatform
// Don't propagate default value changes for unsupported column types.
if
(
$columnDiff
->
hasChanged
(
'default'
)
&&
count
(
$columnDiff
->
changedProperties
)
===
1
&&
!
$this
->
isDefaultValueSupportedForType
(
$columnArray
[
'type'
])
!
$this
->
isDefaultValueSupportedForType
(
$columnArray
[
'type'
])
)
{
continue
;
}
...
...
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
4747fd0c
...
...
@@ -180,7 +180,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
if
(
$this
->
_platform
instanceof
MariaDb1027Platform
)
{
$columnDefault
=
$this
->
getMariaDb1027ColumnDefault
(
$this
->
_platform
,
$tableColumn
[
'default'
]);
}
else
{
$columnDefault
=
(
isset
(
$tableColumn
[
'default'
]))
?
$tableColumn
[
'default'
]
:
null
;
$columnDefault
=
$tableColumn
[
'default'
]
;
}
$options
=
[
...
...
@@ -237,7 +237,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
if
(
$columnDefault
===
'NULL'
||
$columnDefault
===
null
)
{
return
null
;
}
if
(
strpos
(
$columnDefault
,
"'"
)
===
0
)
{
if
(
$columnDefault
[
0
]
===
"'"
)
{
return
stripslashes
(
str_replace
(
"''"
,
"'"
,
preg_replace
(
'/^\'(.*)\'$/'
,
'$1'
,
$columnDefault
)
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
View file @
4747fd0c
...
...
@@ -54,25 +54,25 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
return
new
MySqlSchemaManager
(
$connection
);
}
protected
function
getDatabasePlatformsForVersions
()
protected
function
getDatabasePlatformsForVersions
()
:
array
{
return
array
(
array
(
'5.6.9'
,
MySqlPlatform
::
class
)
,
array
(
'5.7'
,
MySQL57Platform
::
class
)
,
array
(
'5.7.0'
,
MySqlPlatform
::
class
)
,
array
(
'5.7.8'
,
MySqlPlatform
::
class
)
,
array
(
'5.7.9'
,
MySQL57Platform
::
class
)
,
array
(
'5.7.10'
,
MySQL57Platform
::
class
)
,
array
(
'6'
,
MySQL57Platform
::
class
)
,
array
(
'10.0.15-MariaDB-1~wheezy'
,
MySqlPlatform
::
class
)
,
array
(
'5.5.5-10.1.25-MariaDB'
,
MySqlPlatform
::
class
)
,
array
(
'10.1.2a-MariaDB-a1~lenny-log'
,
MySqlPlatform
::
class
)
,
array
(
'5.5.40-MariaDB-1~wheezy'
,
MySqlPlatform
::
class
)
,
array
(
'5.5.40-MariaDB-1~wheezy'
,
MySqlPlatform
::
class
)
,
array
(
'5.5.5-MariaDB-10.2.8+maria~xenial-log'
,
MariaDb1027Platform
::
class
)
,
array
(
'10.2.8-MariaDB-10.2.8+maria~xenial-log'
,
MariaDb1027Platform
::
class
)
,
array
(
'10.2.8-MariaDB-1~lenny-log'
,
MariaDb1027Platform
::
class
)
)
;
return
[
[
'5.6.9'
,
MySqlPlatform
::
class
]
,
[
'5.7'
,
MySQL57Platform
::
class
]
,
[
'5.7.0'
,
MySqlPlatform
::
class
]
,
[
'5.7.8'
,
MySqlPlatform
::
class
]
,
[
'5.7.9'
,
MySQL57Platform
::
class
]
,
[
'5.7.10'
,
MySQL57Platform
::
class
]
,
[
'6'
,
MySQL57Platform
::
class
]
,
[
'10.0.15-MariaDB-1~wheezy'
,
MySqlPlatform
::
class
]
,
[
'5.5.5-10.1.25-MariaDB'
,
MySqlPlatform
::
class
]
,
[
'10.1.2a-MariaDB-a1~lenny-log'
,
MySqlPlatform
::
class
]
,
[
'5.5.40-MariaDB-1~wheezy'
,
MySqlPlatform
::
class
]
,
[
'5.5.40-MariaDB-1~wheezy'
,
MySqlPlatform
::
class
]
,
[
'5.5.5-MariaDB-10.2.8+maria~xenial-log'
,
MariaDb1027Platform
::
class
]
,
[
'10.2.8-MariaDB-10.2.8+maria~xenial-log'
,
MariaDb1027Platform
::
class
]
,
[
'10.2.8-MariaDB-1~lenny-log'
,
MariaDb1027Platform
::
class
]
]
;
}
protected
function
getExceptionConversionData
()
...
...
tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php
View file @
4747fd0c
...
...
@@ -35,12 +35,12 @@ class DriverTest extends PDOMySQLDriverTest
return
new
DrizzleSchemaManager
(
$connection
);
}
protected
function
getDatabasePlatformsForVersions
()
protected
function
getDatabasePlatformsForVersions
()
:
array
{
return
array
(
array
(
'foo'
,
'Doctrine\DBAL\Platforms\DrizzlePlatform'
)
,
array
(
'bar'
,
'Doctrine\DBAL\Platforms\DrizzlePlatform'
)
,
array
(
'baz'
,
'Doctrine\DBAL\Platforms\DrizzlePlatform'
)
,
)
;
return
[
[
'foo'
,
'Doctrine\DBAL\Platforms\DrizzlePlatform'
]
,
[
'bar'
,
'Doctrine\DBAL\Platforms\DrizzlePlatform'
]
,
[
'baz'
,
'Doctrine\DBAL\Platforms\DrizzlePlatform'
]
,
]
;
}
}
tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
View file @
4747fd0c
...
...
@@ -908,19 +908,4 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
self
::
assertContains
(
'bar'
,
$sql
);
self
::
assertNotContains
(
'DATABASE()'
,
$sql
);
}
public
function
testGetDefaultValueDeclarationSQLIsQuotedWithLiteral
()
{
$field
=
[
'type'
=>
Type
::
getType
(
'string'
),
'default'
=>
"'O'Connor said:
\"
Hello
\"
\
\r
'"
];
self
::
assertSame
(
sprintf
(
' DEFAULT %s'
,
$this
->
_platform
->
quoteStringLiteral
(
"'O'Connor said:
\"
Hello
\"
\
\r
'"
)
),
$this
->
_platform
->
getDefaultValueDeclarationSQL
(
$field
)
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
View file @
4747fd0c
...
...
@@ -976,19 +976,4 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
true
);
}
public
function
testGetDefaultValueDeclarationSQLIsQuotedWithLiteral
()
{
$field
=
[
'type'
=>
Type
::
getType
(
'string'
),
'default'
=>
"'O'Connor said:
\"
Hello
\"
\
\r
'"
];
self
::
assertSame
(
sprintf
(
' DEFAULT %s'
,
$this
->
_platform
->
quoteStringLiteral
(
"'O'Connor said:
\"
Hello
\"
\
\r
'"
)
),
$this
->
_platform
->
getDefaultValueDeclarationSQL
(
$field
)
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php
View file @
4747fd0c
...
...
@@ -12,22 +12,22 @@ class MariaDb1027PlatformTest extends AbstractMySQLPlatformTestCase
/**
* {@inheritdoc}
*/
public
function
createPlatform
()
public
function
createPlatform
()
:
MariaDb1027Platform
{
return
new
MariaDb1027Platform
();
}
public
function
testHasNativeJsonType
()
public
function
testHasNativeJsonType
()
:
void
{
self
::
assertTrue
(
$this
->
_platform
->
hasNativeJsonType
());
}
public
function
testReturnsJsonTypeDeclarationSQL
()
public
function
testReturnsJsonTypeDeclarationSQL
()
:
void
{
self
::
assertSame
(
'JSON'
,
$this
->
_platform
->
getJsonTypeDeclarationSQL
([]));
}
public
function
testInitializesJsonTypeMapping
()
public
function
testInitializesJsonTypeMapping
()
:
void
{
self
::
assertTrue
(
$this
->
_platform
->
hasDoctrineTypeMappingFor
(
'json'
));
self
::
assertSame
(
Type
::
JSON
,
$this
->
_platform
->
getDoctrineTypeMapping
(
'json'
));
...
...
@@ -39,7 +39,7 @@ class MariaDb1027PlatformTest extends AbstractMySQLPlatformTestCase
*
* @see AbstractMySQLPlatformTestCase::testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes()
*/
public
function
testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes
()
public
function
testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes
()
:
void
{
$this
->
markTestSkipped
(
'MariaDB102Platform support propagation of default values for BLOB and TEXT columns'
);
}
...
...
@@ -47,7 +47,7 @@ class MariaDb1027PlatformTest extends AbstractMySQLPlatformTestCase
/**
* Since MariaDB 10.2, Text and Blob can have a default value.
*/
public
function
testPropagateDefaultValuesForTextAndBlobColumnTypes
()
public
function
testPropagateDefaultValuesForTextAndBlobColumnTypes
()
:
void
{
$table
=
new
Table
(
"text_blob_default_value"
);
...
...
@@ -69,7 +69,7 @@ class MariaDb1027PlatformTest extends AbstractMySQLPlatformTestCase
self
::
assertFalse
(
$comparator
->
diffTable
(
$table
,
$diffTable
));
}
public
function
testPropagateDefaultValuesForJsonColumnType
()
public
function
testPropagateDefaultValuesForJsonColumnType
()
:
void
{
$table
=
new
Table
(
"text_json_default_value"
);
...
...
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
4747fd0c
...
...
@@ -874,19 +874,4 @@ EOD;
{
self
::
assertContains
(
"'Foo''Bar
\\\\
'"
,
$this
->
_platform
->
getListTableColumnsSQL
(
'foo_table'
,
"Foo'Bar
\\
"
),
''
,
true
);
}
public
function
testGetDefaultValueDeclarationSQLIsQuotedWithLiteral
()
{
$field
=
[
'type'
=>
Type
::
getType
(
'string'
),
'default'
=>
"'O'Connor said:
\"
Hello
\"
\
\r
'"
];
self
::
assertSame
(
sprintf
(
' DEFAULT %s'
,
$this
->
_platform
->
quoteStringLiteral
(
"'O'Connor said:
\"
Hello
\"
\
\r
'"
)
),
$this
->
_platform
->
getDefaultValueDeclarationSQL
(
$field
)
);
}
}
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