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
a490dec8
Unverified
Commit
a490dec8
authored
Aug 02, 2018
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3211 from morozov/issues/3167
Removed support for DB-generated UUIDs
parents
9c36d219
c4d088c8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
5 additions
and
134 deletions
+5
-134
UPGRADE.md
UPGRADE.md
+5
-0
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+0
-14
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+0
-10
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+0
-10
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+0
-10
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+0
-10
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+0
-10
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+0
-13
DBAL421Test.php
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php
+0
-56
SQLAnywherePlatformTest.php
...Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
+0
-1
No files found.
UPGRADE.md
View file @
a490dec8
# Upgrade to 3.0
## BC BREAK: Removed support for DB-generated UUIDs
The support for DB-generated UUIDs was removed as non-portable.
Please generate UUIDs on the application side (e.g. using
[
ramsey/uuid
](
https://packagist.org/packages/ramsey/uuid
)
).
## BC BREAK: Removed MsSQLKeywords class
The
`Doctrine\DBAL\Platforms\MsSQLKeywords`
has been removed.
...
...
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
a490dec8
...
...
@@ -622,20 +622,6 @@ abstract class AbstractPlatform
throw
DBALException
::
notSupported
(
__METHOD__
);
}
/**
* Returns the global unique identifier expression.
*
* @deprecated Use application-generated UUIDs instead
*
* @return string
*
* @throws DBALException If not supported on this platform.
*/
public
function
getGuidExpression
()
{
throw
DBALException
::
notSupported
(
__METHOD__
);
}
/**
* Returns the SQL snippet to get the average value of a column.
*
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
a490dec8
...
...
@@ -78,16 +78,6 @@ class MySqlPlatform extends AbstractPlatform
return
'RLIKE'
;
}
/**
* {@inheritDoc}
*
* @deprecated Use application-generated UUIDs instead
*/
public
function
getGuidExpression
()
{
return
'UUID()'
;
}
/**
* {@inheritDoc}
*/
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
a490dec8
...
...
@@ -84,16 +84,6 @@ class OraclePlatform extends AbstractPlatform
return
'INSTR('
.
$str
.
', '
.
$substr
.
', '
.
$startPos
.
')'
;
}
/**
* {@inheritDoc}
*
* @deprecated Use application-generated UUIDs instead
*/
public
function
getGuidExpression
()
{
return
'SYS_GUID()'
;
}
/**
* {@inheritdoc}
*/
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
a490dec8
...
...
@@ -1021,16 +1021,6 @@ SQL
return
'TIME(0) WITHOUT TIME ZONE'
;
}
/**
* {@inheritDoc}
*
* @deprecated Use application-generated UUIDs instead
*/
public
function
getGuidExpression
()
{
return
'UUID_GENERATE_V4()'
;
}
/**
* {@inheritDoc}
*/
...
...
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
a490dec8
...
...
@@ -667,16 +667,6 @@ class SQLAnywherePlatform extends AbstractPlatform
return
''
;
}
/**
* {@inheritdoc}
*
* @deprecated Use application-generated UUIDs instead
*/
public
function
getGuidExpression
()
{
return
'NEWID()'
;
}
/**
* {@inheritdoc}
*/
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
a490dec8
...
...
@@ -1012,16 +1012,6 @@ SQL
return
'DROP VIEW '
.
$name
;
}
/**
* {@inheritDoc}
*
* @deprecated Use application-generated UUIDs instead
*/
public
function
getGuidExpression
()
{
return
'NEWID()'
;
}
/**
* {@inheritDoc}
*/
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
a490dec8
...
...
@@ -41,19 +41,6 @@ class SqlitePlatform extends AbstractPlatform
return
'REGEXP'
;
}
/**
* {@inheritDoc}
*
* @deprecated Use application-generated UUIDs instead
*/
public
function
getGuidExpression
()
{
return
"HEX(RANDOMBLOB(4)) || '-' || HEX(RANDOMBLOB(2)) || '-4' || "
.
"SUBSTR(HEX(RANDOMBLOB(2)), 2) || '-' || "
.
"SUBSTR('89AB', 1 + (ABS(RANDOM()) % 4), 1) || "
.
"SUBSTR(HEX(RANDOMBLOB(2)), 2) || '-' || HEX(RANDOMBLOB(6))"
;
}
/**
* {@inheritDoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php
deleted
100644 → 0
View file @
9c36d219
<?php
namespace
Doctrine\Tests\DBAL\Functional\Ticket
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
function
in_array
;
use
function
preg_match
;
/**
* @group DBAL-421
*/
class
DBAL421Test
extends
DbalFunctionalTestCase
{
protected
function
setUp
()
:
void
{
parent
::
setUp
();
$platform
=
$this
->
connection
->
getDatabasePlatform
()
->
getName
();
if
(
in_array
(
$platform
,
[
'mysql'
,
'sqlite'
]))
{
return
;
}
$this
->
markTestSkipped
(
'Currently restricted to MySQL and SQLite.'
);
}
public
function
testGuidShouldMatchPattern
()
:
void
{
$guid
=
$this
->
connection
->
query
(
$this
->
getSelectGuidSql
())
->
fetchColumn
();
$pattern
=
'/[0-9A-F]{8}\-[0-9A-F]{4}\-[0-9A-F]{4}\-[8-9A-B][0-9A-F]{3}\-[0-9A-F]{12}/i'
;
self
::
assertEquals
(
1
,
preg_match
(
$pattern
,
$guid
),
'GUID does not match pattern'
);
}
/**
* This test does (of course) not proof that all generated GUIDs are
* random, it should however provide some basic confidence.
*/
public
function
testGuidShouldBeRandom
()
:
void
{
$statement
=
$this
->
connection
->
prepare
(
$this
->
getSelectGuidSql
());
$guids
=
[];
for
(
$i
=
0
;
$i
<
99
;
$i
++
)
{
$statement
->
execute
();
$guid
=
$statement
->
fetchColumn
();
self
::
assertNotContains
(
$guid
,
$guids
,
'Duplicate GUID detected'
);
$guids
[]
=
$guid
;
}
$statement
->
closeCursor
();
}
private
function
getSelectGuidSql
()
:
string
{
return
'SELECT '
.
$this
->
connection
->
getDatabasePlatform
()
->
getGuidExpression
();
}
}
tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
View file @
a490dec8
...
...
@@ -667,7 +667,6 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
self
::
assertEquals
(
'Y-m-d H:i:s.u'
,
$this
->
platform
->
getDateTimeFormatString
());
self
::
assertEquals
(
'H:i:s.u'
,
$this
->
platform
->
getTimeFormatString
());
self
::
assertEquals
(
''
,
$this
->
platform
->
getForUpdateSQL
());
self
::
assertEquals
(
'NEWID()'
,
$this
->
platform
->
getGuidExpression
());
self
::
assertEquals
(
'LOCATE(string_column, substring_column)'
,
$this
->
platform
->
getLocateExpression
(
'string_column'
,
'substring_column'
));
self
::
assertEquals
(
'LOCATE(string_column, substring_column, 1)'
,
$this
->
platform
->
getLocateExpression
(
'string_column'
,
'substring_column'
,
1
));
self
::
assertEquals
(
"HASH(column, 'MD5')"
,
$this
->
platform
->
getMd5Expression
(
'column'
));
...
...
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