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
a04d8040
Unverified
Commit
a04d8040
authored
Nov 18, 2017
by
belgattitude
Committed by
Luís Cobucci
Nov 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed CS
parent
e9c99321
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
20 deletions
+31
-20
AbstractMySQLDriver.php
lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
+10
-2
AbstractMySQLDriverTest.php
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
+1
-1
MySqlSchemaManagerTest.php
...e/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
+20
-17
No files found.
lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
View file @
a04d8040
...
...
@@ -150,7 +150,11 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
*/
private
function
getOracleMysqlVersionNumber
(
string
$versionString
)
:
string
{
if
(
!
preg_match
(
'/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/'
,
$versionString
,
$versionParts
))
{
if
(
!
preg_match
(
'/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/'
,
$versionString
,
$versionParts
))
{
throw
DBALException
::
invalidPlatformVersionSpecified
(
$versionString
,
'<major_version>.<minor_version>.<patch_version>'
...
...
@@ -176,7 +180,11 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
*/
private
function
getMariaDbMysqlVersionNumber
(
string
$versionString
)
:
string
{
if
(
!
preg_match
(
'/^(?:5\.5\.5-)?(mariadb-)?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)/i'
,
$versionString
,
$versionParts
))
{
if
(
!
preg_match
(
'/^(?:5\.5\.5-)?(mariadb-)?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)/i'
,
$versionString
,
$versionParts
))
{
throw
DBALException
::
invalidPlatformVersionSpecified
(
$versionString
,
'^(?:5\.5\.5-)?(mariadb-)?<major_version>.<minor_version>.<patch_version>'
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
View file @
a04d8040
...
...
@@ -54,7 +54,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
return
new
MySqlSchemaManager
(
$connection
);
}
protected
function
getDatabasePlatformsForVersions
()
:
array
protected
function
getDatabasePlatformsForVersions
()
:
array
{
return
[
[
'5.6.9'
,
MySqlPlatform
::
class
],
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
View file @
a04d8040
...
...
@@ -17,7 +17,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
parent
::
setUp
();
if
(
!
Type
::
hasType
(
'point'
))
{
if
(
!
Type
::
hasType
(
'point'
))
{
Type
::
addType
(
'point'
,
MySqlPointType
::
class
);
}
}
...
...
@@ -30,7 +30,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
_sm
->
createTable
(
$tableOld
);
$tableFetched
=
$this
->
_sm
->
listTableDetails
(
"switch_primary_key_columns"
);
$tableNew
=
clone
$tableFetched
;
$tableNew
=
clone
$tableFetched
;
$tableNew
->
setPrimaryKey
(
array
(
'bar_id'
,
'foo_id'
));
$comparator
=
new
Comparator
;
...
...
@@ -47,7 +47,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public
function
testDiffTableBug
()
{
$schema
=
new
Schema
();
$table
=
$schema
->
createTable
(
'diffbug_routing_translations'
);
$table
=
$schema
->
createTable
(
'diffbug_routing_translations'
);
$table
->
addColumn
(
'id'
,
'integer'
);
$table
->
addColumn
(
'route'
,
'string'
);
$table
->
addColumn
(
'locale'
,
'string'
);
...
...
@@ -62,7 +62,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$tableFetched
=
$this
->
_sm
->
listTableDetails
(
"diffbug_routing_translations"
);
$comparator
=
new
Comparator
;
$diff
=
$comparator
->
diffTable
(
$tableFetched
,
$table
);
$diff
=
$comparator
->
diffTable
(
$tableFetched
,
$table
);
self
::
assertFalse
(
$diff
,
"no changes expected."
);
}
...
...
@@ -159,7 +159,9 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public
function
testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes
()
{
if
(
$this
->
_sm
->
getDatabasePlatform
()
instanceof
MariaDb1027Platform
)
{
$this
->
markTestSkipped
(
'MariaDb102Platform supports default values for BLOB and TEXT columns and will propagate values'
);
$this
->
markTestSkipped
(
'MariaDb102Platform supports default values for BLOB and TEXT columns and will propagate values'
);
}
$table
=
new
Table
(
"text_blob_default_value"
);
...
...
@@ -195,7 +197,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public
function
testColumnCollation
()
{
$table
=
new
Table
(
'test_collation'
);
$table
=
new
Table
(
'test_collation'
);
$table
->
addOption
(
'collate'
,
$collation
=
'latin1_swedish_ci'
);
$table
->
addOption
(
'charset'
,
'latin1'
);
$table
->
addColumn
(
'id'
,
'integer'
);
...
...
@@ -218,7 +220,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public
function
testListLobTypeColumns
()
{
$tableName
=
'lob_type_columns'
;
$table
=
new
Table
(
$tableName
);
$table
=
new
Table
(
$tableName
);
$table
->
addColumn
(
'col_tinytext'
,
'text'
,
array
(
'length'
=>
MySqlPlatform
::
LENGTH_LIMIT_TINYTEXT
));
$table
->
addColumn
(
'col_text'
,
'text'
,
array
(
'length'
=>
MySqlPlatform
::
LENGTH_LIMIT_TEXT
));
...
...
@@ -232,9 +234,9 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
_sm
->
dropAndCreateTable
(
$table
);
$platform
=
$this
->
_sm
->
getDatabasePlatform
();
$platform
=
$this
->
_sm
->
getDatabasePlatform
();
$offlineColumns
=
$table
->
getColumns
();
$onlineColumns
=
$this
->
_sm
->
listTableColumns
(
$tableName
);
$onlineColumns
=
$this
->
_sm
->
listTableColumns
(
$tableName
);
self
::
assertSame
(
$platform
->
getClobTypeDeclarationSQL
(
$offlineColumns
[
'col_tinytext'
]
->
toArray
()),
...
...
@@ -297,7 +299,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public
function
testListDecimalTypeColumns
()
{
$tableName
=
'test_list_decimal_columns'
;
$table
=
new
Table
(
$tableName
);
$table
=
new
Table
(
$tableName
);
$table
->
addColumn
(
'col'
,
'decimal'
);
$table
->
addColumn
(
'col_unsigned'
,
'decimal'
,
array
(
'unsigned'
=>
true
));
...
...
@@ -318,7 +320,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public
function
testListFloatTypeColumns
()
{
$tableName
=
'test_list_float_columns'
;
$table
=
new
Table
(
$tableName
);
$table
=
new
Table
(
$tableName
);
$table
->
addColumn
(
'col'
,
'float'
);
$table
->
addColumn
(
'col_unsigned'
,
'float'
,
array
(
'unsigned'
=>
true
));
...
...
@@ -336,7 +338,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public
function
testJsonColumnType
()
:
void
{
$platform
=
$this
->
_sm
->
getDatabasePlatform
();
if
(
!
$platform
->
hasNativeJsonType
())
{
if
(
!
$platform
->
hasNativeJsonType
())
{
$this
->
markTestSkipped
(
"Requires native JSON type"
);
}
...
...
@@ -372,7 +374,8 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
self
::
assertFalse
(
$diff
,
"Tables should be identical with column defaults."
);
}
public
function
testColumnDefaultsAreValid
()
{
public
function
testColumnDefaultsAreValid
()
{
$table
=
new
Table
(
"test_column_defaults_are_valid"
);
...
...
@@ -417,7 +420,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
*/
public
function
testColumnDefaultValuesCurrentTimeAndDate
()
:
void
{
if
(
!
$this
->
_sm
->
getDatabasePlatform
()
instanceof
MariaDb1027Platform
)
{
if
(
!
$this
->
_sm
->
getDatabasePlatform
()
instanceof
MariaDb1027Platform
)
{
$this
->
markTestSkipped
(
'Only relevant for MariaDb102Platform.'
);
}
...
...
@@ -426,8 +429,8 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table
=
new
Table
(
"test_column_defaults_current_time_and_date"
);
$currentTimestampSql
=
$platform
->
getCurrentTimestampSQL
();
$currentTimeSql
=
$platform
->
getCurrentTimeSQL
();
$currentDateSql
=
$platform
->
getCurrentDateSQL
();
$currentTimeSql
=
$platform
->
getCurrentTimeSQL
();
$currentDateSql
=
$platform
->
getCurrentDateSQL
();
$table
->
addColumn
(
'col_datetime'
,
'datetime'
,
[
'default'
=>
$currentTimestampSql
]);
$table
->
addColumn
(
'col_date'
,
'date'
,
[
'default'
=>
$currentDateSql
]);
...
...
@@ -472,7 +475,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
'\\%'
,
// A percent (%) character
'\\_'
,
// An underscore (_) character
];
$default
=
implode
(
'+'
,
$escapeSequences
);
$default
=
implode
(
'+'
,
$escapeSequences
);
$sql
=
"CREATE TABLE test_column_defaults_with_create(
col1 VARCHAR(255) NULL DEFAULT
{
$platform
->
quoteStringLiteral
(
$default
)
}
...
...
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