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
db642e60
Unverified
Commit
db642e60
authored
Mar 16, 2018
by
Michael Moravec
Committed by
Sergei Morozov
Mar 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop support for SQL Server <2008
parent
50375f96
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
72 additions
and
111 deletions
+72
-111
UPGRADE.md
UPGRADE.md
+13
-0
platforms.rst
docs/en/reference/platforms.rst
+1
-3
types.rst
docs/en/reference/types.rst
+3
-9
AbstractSQLServerDriver.php
lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php
+1
-7
SQLServer2012Keywords.php
...octrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php
+1
-1
SQLServerKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php
+1
-0
SQLServer2005Platform.php
lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php
+0
-48
SQLServer2008Platform.php
lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php
+1
-1
SQLServer2012Platform.php
lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php
+1
-1
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+31
-11
ReservedWordsCommand.php
...trine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
+0
-6
AbstractSQLServerDriverTest.php
...octrine/Tests/DBAL/Driver/AbstractSQLServerDriverTest.php
+14
-24
SQLServerPlatformTest.php
...s/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
+5
-0
No files found.
UPGRADE.md
View file @
db642e60
...
...
@@ -8,6 +8,19 @@ All implementations of the `PingableConnection` and `ServerInfoAwareConnection`
All implementations of the
`VersionAwarePlatformDriver`
interface have to implement the methods defined in the
`Driver`
interface as well.
## BC BREAK: Removed support for SQL Server 2005 and older
DBAL now requires SQL Server 2008 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer SQL Server version (2012+ is recommended).
`Doctrine\DBAL\Platforms\SQLServerPlatform`
and
`Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords`
now represent the SQL Server 2008.
The following classes have been removed:
*
`Doctrine\DBAL\Platforms\SQLServer2005Platform`
*
`Doctrine\DBAL\Platforms\SQLServer2008Platform`
*
`Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords`
*
`Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords`
## BC BREAK: Removed support for PostgreSQL 9.2 and older
DBAL now requires PostgeSQL 9.3 or newer, support for unmaintained versions has been dropped.
...
...
docs/en/reference/platforms.rst
View file @
db642e60
...
...
@@ -50,9 +50,7 @@ Oracle
Microsoft SQL Server
^^^^^^^^^^^^^^^^^^^^
- ``SQLServerPlatform`` for version 2000 and above (deprecated).
- ``SQLServer2005Platform`` for version 2005 and above (deprecated).
- ``SQLServer2008Platform`` for version 2008 and above (deprecated).
- ``SQLServerPlatform`` for version 2008 and above.
- ``SQLServer2012Platform`` for version 2012 and above.
PostgreSQL
...
...
docs/en/reference/types.rst
View file @
db642e60
...
...
@@ -701,9 +701,7 @@ Please also notice the mapping specific footnotes for additional information.
| | +--------------------------+ | |
| | | **Drizzle** | | |
| | +--------------------------+---------+ |
| | | **SQL Server** | >= 2008 | |
| | | +---------+----------------------------------------------------------+
| | | | < 2008 | ``DATETIME`` [16]_ |
| | | **SQL Server** | "all" | |
+-------------------+---------------+--------------------------+---------+----------------------------------------------------------+
| **datetime** | ``\DateTime`` | **MySQL** | *all* | ``DATETIME`` [13]_ |
| | +--------------------------+ +----------------------------------------------------------+
...
...
@@ -725,9 +723,7 @@ Please also notice the mapping specific footnotes for additional information.
| | +--------------------------+ | |
| | | **SQLite** | | |
| | +--------------------------+---------+ |
| | | **SQL Server** | < 2008 | |
| | | +---------+----------------------------------------------------------+
| | | | >= 2008 | ``DATETIMEOFFSET(6)`` |
| | | **SQL Server** | "all" | |
| | +--------------------------+---------+----------------------------------------------------------+
| | | **PostgreSQL** | *all* | ``TIMESTAMP(0) WITH TIME ZONE`` |
| | +--------------------------+ | |
...
...
@@ -749,9 +745,7 @@ Please also notice the mapping specific footnotes for additional information.
| | +--------------------------+---------+----------------------------------------------------------+
| | | **Oracle** | *all* | ``DATE`` [16]_ |
| | +--------------------------+---------+----------------------------------------------------------+
| | | **SQL Server** | < 2008 | ``DATETIME`` [16]_ |
| | | +---------+----------------------------------------------------------+
| | | | >= 2008 | ``TIME(0)`` |
| | | **SQL Server** | "all" | ``TIME(0)`` |
+-------------------+---------------+--------------------------+---------+----------------------------------------------------------+
| **array** [1]_ | ``array`` | **MySQL** | *all* | ``TINYTEXT`` [17]_ |
+-------------------+ | | +----------------------------------------------------------+
...
...
lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php
View file @
db642e60
...
...
@@ -4,8 +4,6 @@ namespace Doctrine\DBAL\Driver;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\Platforms\SQLServer2005Platform
;
use
Doctrine\DBAL\Platforms\SQLServer2008Platform
;
use
Doctrine\DBAL\Platforms\SQLServer2012Platform
;
use
Doctrine\DBAL\Platforms\SQLServerPlatform
;
use
Doctrine\DBAL\Schema\SQLServerSchemaManager
;
...
...
@@ -43,10 +41,6 @@ abstract class AbstractSQLServerDriver implements VersionAwarePlatformDriver
switch
(
true
)
{
case
version_compare
(
$version
,
'11.00.2100'
,
'>='
)
:
return
new
SQLServer2012Platform
();
case
version_compare
(
$version
,
'10.00.1600'
,
'>='
)
:
return
new
SQLServer2008Platform
();
case
version_compare
(
$version
,
'9.00.1399'
,
'>='
)
:
return
new
SQLServer2005Platform
();
default
:
return
new
SQLServerPlatform
();
}
...
...
@@ -67,7 +61,7 @@ abstract class AbstractSQLServerDriver implements VersionAwarePlatformDriver
*/
public
function
getDatabasePlatform
()
{
return
new
SQLServer
2008
Platform
();
return
new
SQLServerPlatform
();
}
/**
...
...
lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php
View file @
db642e60
...
...
@@ -9,7 +9,7 @@ use function array_merge;
*
* @link www.doctrine-project.com
*/
class
SQLServer2012Keywords
extends
SQLServer
2008
Keywords
class
SQLServer2012Keywords
extends
SQLServerKeywords
{
/**
* {@inheritdoc}
...
...
lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php
View file @
db642e60
...
...
@@ -121,6 +121,7 @@ class SQLServerKeywords extends KeywordList
'LIKE'
,
'LINENO'
,
'LOAD'
,
'MERGE'
,
'NATIONAL'
,
'NOCHECK '
,
'NONCLUSTERED'
,
...
...
lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php
deleted
100644 → 0
View file @
50375f96
<?php
namespace
Doctrine\DBAL\Platforms
;
/**
* Platform to ensure compatibility of Doctrine with Microsoft SQL Server 2005 version and
* higher.
*
* Differences to SQL Server 2008 are:
*
* - DATETIME2 datatype does not exist, only DATETIME which has a precision of
* 3. This is not supported by PHP DateTime, so we are emulating it by
* setting .000 manually.
* - Starting with SQLServer2005 VARCHAR(MAX), VARBINARY(MAX) and
* NVARCHAR(max) replace the old TEXT, NTEXT and IMAGE types. See
* {@link http://www.sql-server-helper.com/faq/sql-server-2005-varchar-max-p01.aspx}
* for more information.
*
* @deprecated Use SQL Server 2012 or newer
*/
class
SQLServer2005Platform
extends
SQLServerPlatform
{
/**
* {@inheritDoc}
*/
public
function
supportsLimitOffset
()
{
return
true
;
}
/**
* {@inheritDoc}
*/
public
function
getClobTypeDeclarationSQL
(
array
$field
)
{
return
'VARCHAR(MAX)'
;
}
/**
* {@inheritdoc}
*
* Returns Microsoft SQL Server 2005 specific keywords class
*/
protected
function
getReservedKeywordsClass
()
{
return
Keywords\SQLServer2005Keywords
::
class
;
}
}
lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php
View file @
db642e60
...
...
@@ -10,7 +10,7 @@ namespace Doctrine\DBAL\Platforms;
*
* @deprecated Use SQL Server 2012 or newer
*/
class
SQLServer2008Platform
extends
SQLServer
2005
Platform
class
SQLServer2008Platform
extends
SQLServerPlatform
{
/**
* {@inheritDoc}
...
...
lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php
View file @
db642e60
...
...
@@ -14,7 +14,7 @@ use function substr_count;
* Differences to SQL Server 2008 and before are that sequences are introduced,
* and support for the new OFFSET... FETCH syntax for result pagination has been added.
*/
class
SQLServer2012Platform
extends
SQLServer
2008
Platform
class
SQLServer2012Platform
extends
SQLServerPlatform
{
/**
* {@inheritdoc}
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
db642e60
...
...
@@ -38,8 +38,6 @@ use function substr_count;
/**
* The SQLServerPlatform provides the behavior, features and SQL dialect of the
* Microsoft SQL Server database platform.
*
* @deprecated Use SQL Server 2012 or newer
*/
class
SQLServerPlatform
extends
AbstractPlatform
{
...
...
@@ -898,7 +896,7 @@ SQL
{
// "sysdiagrams" table must be ignored as it's internal SQL Server table for Database Diagrams
// Category 2 must be ignored as it is "MS SQL Server 'pseudo-system' object[s]" for replication
return
"SELECT name FROM sysobjects WHERE type = 'U' AND name != 'sysdiagrams' AND category != 2 ORDER BY name"
;
return
"SELECT name
, SCHEMA_NAME (uid) AS schema_name
FROM sysobjects WHERE type = 'U' AND name != 'sysdiagrams' AND category != 2 ORDER BY name"
;
}
/**
...
...
@@ -1186,6 +1184,14 @@ SQL
return
'UNIQUEIDENTIFIER'
;
}
/**
* {@inheritDoc}
*/
public
function
getDateTimeTzTypeDeclarationSQL
(
array
$fieldDeclaration
)
{
return
'DATETIMEOFFSET(6)'
;
}
/**
* {@inheritDoc}
*/
...
...
@@ -1231,7 +1237,9 @@ SQL
*/
public
function
getDateTimeTypeDeclarationSQL
(
array
$fieldDeclaration
)
{
return
'DATETIME'
;
// 3 - microseconds precision length
// http://msdn.microsoft.com/en-us/library/ms187819.aspx
return
'DATETIME2(6)'
;
}
/**
...
...
@@ -1239,7 +1247,7 @@ SQL
*/
public
function
getDateTypeDeclarationSQL
(
array
$fieldDeclaration
)
{
return
'DATE
TIME
'
;
return
'DATE'
;
}
/**
...
...
@@ -1247,7 +1255,7 @@ SQL
*/
public
function
getTimeTypeDeclarationSQL
(
array
$fieldDeclaration
)
{
return
'
DATETIME
'
;
return
'
TIME(0)
'
;
}
/**
...
...
@@ -1396,7 +1404,7 @@ SQL
*/
public
function
supportsLimitOffset
()
{
return
fals
e
;
return
tru
e
;
}
/**
...
...
@@ -1440,7 +1448,7 @@ SQL
*/
public
function
getDateTimeFormatString
()
{
return
'Y-m-d H:i:s.
000
'
;
return
'Y-m-d H:i:s.
u
'
;
}
/**
...
...
@@ -1448,7 +1456,7 @@ SQL
*/
public
function
getDateFormatString
()
{
return
'Y-m-d
H:i:s.000
'
;
return
'Y-m-d'
;
}
/**
...
...
@@ -1456,7 +1464,7 @@ SQL
*/
public
function
getTimeFormatString
()
{
return
'
Y-m-d H:i:s.000
'
;
return
'
H:i:s
'
;
}
/**
...
...
@@ -1464,7 +1472,7 @@ SQL
*/
public
function
getDateTimeTzFormatString
()
{
return
$this
->
getDateTimeFormatString
()
;
return
'Y-m-d H:i:s.u P'
;
}
/**
...
...
@@ -1506,6 +1514,10 @@ SQL
'varbinary'
=>
'binary'
,
'image'
=>
'blob'
,
'uniqueidentifier'
=>
'guid'
,
'datetime2'
=>
'datetime'
,
'date'
=>
'date'
,
'time'
=>
'time'
,
'datetimeoffset'
=>
'datetimetz'
,
];
}
...
...
@@ -1636,6 +1648,14 @@ SQL
return
$name
.
' '
.
$columnDef
;
}
/**
* {@inheritdoc}
*/
protected
function
getLikeWildcardCharacters
()
:
string
{
return
parent
::
getLikeWildcardCharacters
()
.
'[]^'
;
}
/**
* Returns a unique default constraint name for a table and column.
*
...
...
lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
View file @
db642e60
...
...
@@ -17,8 +17,6 @@ use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords;
use
Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords
;
use
InvalidArgumentException
;
...
...
@@ -38,8 +36,6 @@ class ReservedWordsCommand extends Command
'mysql57'
=>
MySQL57Keywords
::
class
,
'mysql80'
=>
MySQL80Keywords
::
class
,
'sqlserver'
=>
SQLServerKeywords
::
class
,
'sqlserver2005'
=>
SQLServer2005Keywords
::
class
,
'sqlserver2008'
=>
SQLServer2008Keywords
::
class
,
'sqlserver2012'
=>
SQLServer2012Keywords
::
class
,
'sqlite'
=>
SQLiteKeywords
::
class
,
'pgsql'
=>
PostgreSQLKeywords
::
class
,
...
...
@@ -106,8 +102,6 @@ The following keyword lists are currently shipped with Doctrine:
* sqlite
* oracle
* sqlserver
* sqlserver2005
* sqlserver2008
* sqlserver2012
* sqlanywhere
* sqlanywhere11
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractSQLServerDriverTest.php
View file @
db642e60
...
...
@@ -6,8 +6,6 @@ use Doctrine\DBAL\Connection;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Driver\AbstractSQLServerDriver
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\SQLServer2005Platform
;
use
Doctrine\DBAL\Platforms\SQLServer2008Platform
;
use
Doctrine\DBAL\Platforms\SQLServer2012Platform
;
use
Doctrine\DBAL\Platforms\SQLServerPlatform
;
use
Doctrine\DBAL\Schema\AbstractSchemaManager
;
...
...
@@ -22,7 +20,7 @@ class AbstractSQLServerDriverTest extends AbstractDriverTest
protected
function
createPlatform
()
:
AbstractPlatform
{
return
new
SQLServer
2008
Platform
();
return
new
SQLServerPlatform
();
}
protected
function
createSchemaManager
(
Connection
$connection
)
:
AbstractSchemaManager
...
...
@@ -36,27 +34,19 @@ class AbstractSQLServerDriverTest extends AbstractDriverTest
protected
function
getDatabasePlatformsForVersions
()
:
array
{
return
[
[
'9'
,
SQLServerPlatform
::
class
],
[
'9.00'
,
SQLServerPlatform
::
class
],
[
'9.00.0'
,
SQLServerPlatform
::
class
],
[
'9.00.1398'
,
SQLServerPlatform
::
class
],
[
'9.00.1398.99'
,
SQLServerPlatform
::
class
],
[
'9.00.1399'
,
SQLServer2005Platform
::
class
],
[
'9.00.1399.0'
,
SQLServer2005Platform
::
class
],
[
'9.00.1399.99'
,
SQLServer2005Platform
::
class
],
[
'9.00.1400'
,
SQLServer2005Platform
::
class
],
[
'9.10'
,
SQLServer2005Platform
::
class
],
[
'9.10.9999'
,
SQLServer2005Platform
::
class
],
[
'10.00.1599'
,
SQLServer2005Platform
::
class
],
[
'10.00.1599.99'
,
SQLServer2005Platform
::
class
],
[
'10.00.1600'
,
SQLServer2008Platform
::
class
],
[
'10.00.1600.0'
,
SQLServer2008Platform
::
class
],
[
'10.00.1600.99'
,
SQLServer2008Platform
::
class
],
[
'10.00.1601'
,
SQLServer2008Platform
::
class
],
[
'10.10'
,
SQLServer2008Platform
::
class
],
[
'10.10.9999'
,
SQLServer2008Platform
::
class
],
[
'11.00.2099'
,
SQLServer2008Platform
::
class
],
[
'11.00.2099.99'
,
SQLServer2008Platform
::
class
],
[
'10'
,
SQLServerPlatform
::
class
],
[
'10.00'
,
SQLServerPlatform
::
class
],
[
'10.00.0'
,
SQLServerPlatform
::
class
],
[
'10.00.1599'
,
SQLServerPlatform
::
class
],
[
'10.00.1599.99'
,
SQLServerPlatform
::
class
],
[
'10.00.1600'
,
SQLServerPlatform
::
class
],
[
'10.00.1600.0'
,
SQLServerPlatform
::
class
],
[
'10.00.1600.99'
,
SQLServerPlatform
::
class
],
[
'10.00.1601'
,
SQLServerPlatform
::
class
],
[
'10.10'
,
SQLServerPlatform
::
class
],
[
'10.10.9999'
,
SQLServerPlatform
::
class
],
[
'11.00.2099'
,
SQLServerPlatform
::
class
],
[
'11.00.2099.99'
,
SQLServerPlatform
::
class
],
[
'11.00.2100'
,
SQLServer2012Platform
::
class
],
[
'11.00.2100.0'
,
SQLServer2012Platform
::
class
],
[
'11.00.2100.99'
,
SQLServer2012Platform
::
class
],
...
...
tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
View file @
db642e60
...
...
@@ -75,4 +75,9 @@ class SQLServerPlatformTest extends AbstractSQLServerPlatformTestCase
],
];
}
public
function
testGeneratesTypeDeclarationForDateTimeTz
()
:
void
{
self
::
assertEquals
(
'DATETIMEOFFSET(6)'
,
$this
->
platform
->
getDateTimeTzTypeDeclarationSQL
([]));
}
}
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