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
faefe46d
Unverified
Commit
faefe46d
authored
Mar 16, 2018
by
Michael Moravec
Committed by
Sergei Morozov
Nov 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop support for PostgreSQL <9.3
parent
0a18df20
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
154 additions
and
450 deletions
+154
-450
.scrutinizer.yml
.scrutinizer.yml
+1
-1
.travis.yml
.travis.yml
+0
-7
UPGRADE.md
UPGRADE.md
+13
-0
configuration.rst
docs/en/reference/configuration.rst
+5
-5
platforms.rst
docs/en/reference/platforms.rst
+1
-2
types.rst
docs/en/reference/types.rst
+1
-3
AbstractPostgreSQLDriver.php
lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
+0
-6
PostgreSQL91Keywords.php
...Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php
+0
-126
PostgreSQL92Keywords.php
...Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php
+0
-29
PostgreSQL94Keywords.php
...Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php
+1
-1
PostgreSQLKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
+17
-5
PostgreSQL91Platform.php
lib/Doctrine/DBAL/Platforms/PostgreSQL91Platform.php
+0
-46
PostgreSQL92Platform.php
lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php
+0
-69
PostgreSQL94Platform.php
lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php
+1
-1
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+40
-2
ReservedWordsCommand.php
...trine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
+7
-22
AbstractPostgreSQLDriverTest.php
...ctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
+3
-11
PostgreSQL91PlatformTest.php
...octrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php
+0
-41
PostgreSQL92PlatformTest.php
...octrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php
+0
-72
PostgreSQL94PlatformTest.php
...octrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php
+1
-1
PostgreSqlPlatformTest.php
.../Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+63
-0
No files found.
.scrutinizer.yml
View file @
faefe46d
...
...
@@ -21,7 +21,7 @@ before_commands:
tools
:
external_code_coverage
:
timeout
:
3600
runs
:
30
# 25
x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
runs
:
29
# 24
x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
filter
:
excluded_paths
:
...
...
.travis.yml
View file @
faefe46d
...
...
@@ -184,13 +184,6 @@ jobs:
env
:
DB=mariadb.mysqli MARIADB_VERSION=10.3 COVERAGE=yes
addons
:
mariadb
:
10.3
-
stage
:
Test
php
:
7.3
env
:
DB=pgsql POSTGRESQL_VERSION=9.2 COVERAGE=yes
services
:
-
postgresql
addons
:
postgresql
:
"
9.2"
-
stage
:
Test
php
:
7.3
env
:
DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes
...
...
UPGRADE.md
View file @
faefe46d
# Upgrade to 3.0
## 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.
If you are using any of the legacy versions, you have to upgrade to newer PostgreSQL version (9.6+ is recommended).
`Doctrine\DBAL\Platforms\PostgreSqlPlatform`
and
`Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords`
now represent the PostgreSQL 9.3.
The following classes have been removed:
*
`Doctrine\DBAL\Platforms\PostgreSQL91Platform`
*
`Doctrine\DBAL\Platforms\PostgreSQL92Platform`
*
`Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords`
*
`Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords`
## BC BREAK: Removed Doctrine\DBAL\Version
The Doctrine
\D
BAL
\V
ersion class is no longer available: please refrain from checking the DBAL version at runtime.
...
...
docs/en/reference/configuration.rst
View file @
faefe46d
...
...
@@ -229,20 +229,20 @@ pdo_pgsql
- ``sslmode`` (string): Determines whether or with what priority
a SSL TCP/IP connection will be negotiated with the server.
See the list of available modes:
`http
://www.postgresql.org/docs/9.1
/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
`http
s://www.postgresql.org/docs/9.3
/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
- ``sslrootcert`` (string): specifies the name of a file containing
SSL certificate authority (CA) certificate(s). If the file exists,
the server's certificate will be verified to be signed by one of these
authorities.
See http
://www.postgresql.org/docs/9.0
/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
See http
s://www.postgresql.org/docs/9.3
/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
- ``sslcert`` (string): specifies the file name of the client SSL certificate.
See `https://www.postgresql.org/docs/9.
1
/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT`
See `https://www.postgresql.org/docs/9.
3
/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT`
- ``sslkey`` (string): specifies the location for the secret key used for the
client certificate.
See `https://www.postgresql.org/docs/9.
1
/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY`
See `https://www.postgresql.org/docs/9.
3
/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY`
- ``sslcrl`` (string): specifies the file name of the SSL certificate
revocation list (CRL).
See `https://www.postgresql.org/docs/9.
1
/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
See `https://www.postgresql.org/docs/9.
3
/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
- ``application_name`` (string): Name of the application that is
connecting to database. Optional. It will be displayed at ``pg_stat_activity``.
...
...
docs/en/reference/platforms.rst
View file @
faefe46d
...
...
@@ -59,9 +59,8 @@ PostgreSQL
^^^^^^^^^^
- ``PostgreSqlPlatform`` for all versions.
- ``PostgreSQL91Platform`` for version 9.1 and above.
- ``PostgreSQL92Platform`` for version 9.2 and above.
- ``PostgreSQL94Platform`` for version 9.4 and above.
- ``PostgreSQL100Platform`` for version 10.0 and above.
SAP Sybase SQL Anywhere
^^^^^^^^^^^^^^^^^^^^^^^
...
...
docs/en/reference/types.rst
View file @
faefe46d
...
...
@@ -749,9 +749,7 @@ Please also notice the mapping specific footnotes for additional information.
| | | | +----------------------------------------------------------+
| | | | | ``LONGTEXT`` [19]_ |
| | +--------------------------+---------+----------------------------------------------------------+
| | | **PostgreSQL** | < 9.2 | ``TEXT`` [1]_ |
| | | +---------+----------------------------------------------------------+
| | | | < 9.4 | ``JSON`` |
| | | **PostgreSQL** | < 9.4 | ``JSON`` |
| | | +---------+----------------------------------------------------------+
| | | | >= 9.4 | ``JSON`` [20]_ |
| | | | +----------------------------------------------------------+
...
...
lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
View file @
faefe46d
...
...
@@ -7,8 +7,6 @@ use Doctrine\DBAL\DBALException;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\Platforms\PostgreSQL100Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL91Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL92Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL94Platform
;
use
Doctrine\DBAL\Platforms\PostgreSqlPlatform
;
use
Doctrine\DBAL\Schema\PostgreSqlSchemaManager
;
...
...
@@ -101,10 +99,6 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri
return
new
PostgreSQL100Platform
();
case
version_compare
(
$version
,
'9.4'
,
'>='
)
:
return
new
PostgreSQL94Platform
();
case
version_compare
(
$version
,
'9.2'
,
'>='
)
:
return
new
PostgreSQL92Platform
();
case
version_compare
(
$version
,
'9.1'
,
'>='
)
:
return
new
PostgreSQL91Platform
();
default
:
return
new
PostgreSqlPlatform
();
}
...
...
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL91Keywords.php
deleted
100644 → 0
View file @
0a18df20
<?php
namespace
Doctrine\DBAL\Platforms\Keywords
;
/**
* PostgreSQL 9.1 reserved keywords list.
*/
class
PostgreSQL91Keywords
extends
PostgreSQLKeywords
{
/**
* {@inheritdoc}
*/
public
function
getName
()
{
return
'PostgreSQL91'
;
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.1/static/sql-keywords-appendix.html
*/
protected
function
getKeywords
()
{
return
[
'ALL'
,
'ANALYSE'
,
'ANALYZE'
,
'AND'
,
'ANY'
,
'ARRAY'
,
'AS'
,
'ASC'
,
'ASYMMETRIC'
,
'AUTHORIZATION'
,
'BINARY'
,
'BOTH'
,
'CASE'
,
'CAST'
,
'CHECK'
,
'COLLATE'
,
'COLUMN'
,
'CONCURRENTLY'
,
'CONSTRAINT'
,
'CREATE'
,
'CROSS'
,
'CURRENT_CATALOG'
,
'CURRENT_DATE'
,
'CURRENT_ROLE'
,
'CURRENT_SCHEMA'
,
'CURRENT_TIME'
,
'CURRENT_TIMESTAMP'
,
'CURRENT_USER'
,
'DEFAULT'
,
'DEFERRABLE'
,
'DESC'
,
'DISTINCT'
,
'DO'
,
'ELSE'
,
'END'
,
'EXCEPT'
,
'FALSE'
,
'FETCH'
,
'FOR'
,
'FOREIGN'
,
'FREEZE'
,
'FROM'
,
'FULL'
,
'GRANT'
,
'GROUP'
,
'HAVING'
,
'ILIKE'
,
'IN'
,
'INITIALLY'
,
'INNER'
,
'INTERSECT'
,
'INTO'
,
'IS'
,
'ISNULL'
,
'JOIN'
,
'LEADING'
,
'LEFT'
,
'LIKE'
,
'LIMIT'
,
'LOCALTIME'
,
'LOCALTIMESTAMP'
,
'NATURAL'
,
'NOT'
,
'NOTNULL'
,
'NULL'
,
'OFFSET'
,
'ON'
,
'ONLY'
,
'OR'
,
'ORDER'
,
'OUTER'
,
'OVER'
,
'OVERLAPS'
,
'PLACING'
,
'PRIMARY'
,
'REFERENCES'
,
'RETURNING'
,
'RIGHT'
,
'SELECT'
,
'SESSION_USER'
,
'SIMILAR'
,
'SOME'
,
'SYMMETRIC'
,
'TABLE'
,
'THEN'
,
'TO'
,
'TRAILING'
,
'TRUE'
,
'UNION'
,
'UNIQUE'
,
'USER'
,
'USING'
,
'VARIADIC'
,
'VERBOSE'
,
'WHEN'
,
'WHERE'
,
'WINDOW'
,
'WITH'
,
];
}
}
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL92Keywords.php
deleted
100644 → 0
View file @
0a18df20
<?php
namespace
Doctrine\DBAL\Platforms\Keywords
;
use
function
array_merge
;
/**
* PostgreSQL 9.2 reserved keywords list.
*/
class
PostgreSQL92Keywords
extends
PostgreSQL91Keywords
{
/**
* {@inheritdoc}
*/
public
function
getName
()
{
return
'PostgreSQL92'
;
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.2/static/sql-keywords-appendix.html
*/
protected
function
getKeywords
()
{
return
array_merge
(
parent
::
getKeywords
(),
[
'COLLATION'
]);
}
}
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php
View file @
faefe46d
...
...
@@ -8,7 +8,7 @@ use function array_merge;
/**
* PostgreSQL 9.4 reserved keywords list.
*/
class
PostgreSQL94Keywords
extends
PostgreSQL
92
Keywords
class
PostgreSQL94Keywords
extends
PostgreSQLKeywords
{
/**
* {@inheritdoc}
...
...
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
View file @
faefe46d
...
...
@@ -3,7 +3,7 @@
namespace
Doctrine\DBAL\Platforms\Keywords
;
/**
* PostgreSQL
Keyword
list.
* PostgreSQL
9.3 keywords
list.
*/
class
PostgreSQLKeywords
extends
KeywordList
{
...
...
@@ -26,20 +26,27 @@ class PostgreSQLKeywords extends KeywordList
'ANALYZE'
,
'AND'
,
'ANY'
,
'ARRAY'
,
'AS'
,
'ASC'
,
'ASYMMETRIC'
,
'AUTHORIZATION'
,
'BETWEEN'
,
'BINARY'
,
'BOTH'
,
'CASE'
,
'CAST'
,
'CHECK'
,
'COLLATE'
,
'COLLATION'
,
'COLUMN'
,
'CONCURRENTLY'
,
'CONSTRAINT'
,
'CREATE'
,
'CROSS'
,
'CURRENT_CATALOG'
,
'CURRENT_DATE'
,
'CURRENT_ROLE'
,
'CURRENT_SCHEMA'
,
'CURRENT_TIME'
,
'CURRENT_TIMESTAMP'
,
'CURRENT_USER'
,
...
...
@@ -52,6 +59,7 @@ class PostgreSQLKeywords extends KeywordList
'END'
,
'EXCEPT'
,
'FALSE'
,
'FETCH'
,
'FOR'
,
'FOREIGN'
,
'FREEZE'
,
...
...
@@ -76,26 +84,27 @@ class PostgreSQLKeywords extends KeywordList
'LOCALTIME'
,
'LOCALTIMESTAMP'
,
'NATURAL'
,
'NEW'
,
'NOT'
,
'NOTNULL'
,
'NULL'
,
'OFF'
,
'OFFSET'
,
'OLD'
,
'ON'
,
'ONLY'
,
'OR'
,
'ORDER'
,
'OUTER'
,
'OVER'
,
'OVERLAPS'
,
'PLACING'
,
'PRIMARY'
,
'REFERENCES'
,
'RETURNING'
,
'RIGHT'
,
'SELECT'
,
'SESSION_USER'
,
'SIMILAR'
,
'SOME'
,
'SYMMETRIC'
,
'TABLE'
,
'THEN'
,
'TO'
,
...
...
@@ -105,9 +114,12 @@ class PostgreSQLKeywords extends KeywordList
'UNIQUE'
,
'USER'
,
'USING'
,
'VARIADIC'
,
'VERBOSE'
,
'WHEN'
,
'WHERE'
,
'WINDOW'
,
'WITH'
,
];
}
}
lib/Doctrine/DBAL/Platforms/PostgreSQL91Platform.php
deleted
100644 → 0
View file @
0a18df20
<?php
namespace
Doctrine\DBAL\Platforms
;
use
function
explode
;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.1 database platform.
*/
class
PostgreSQL91Platform
extends
PostgreSqlPlatform
{
/**
* {@inheritDoc}
*/
public
function
supportsColumnCollation
()
{
return
true
;
}
/**
* {@inheritdoc}
*/
protected
function
getReservedKeywordsClass
()
{
return
Keywords\PostgreSQL91Keywords
::
class
;
}
/**
* {@inheritDoc}
*/
public
function
getColumnCollationDeclarationSQL
(
$collation
)
{
return
'COLLATE '
.
$this
->
quoteSingleIdentifier
(
$collation
);
}
/**
* {@inheritDoc}
*/
public
function
getListTableColumnsSQL
(
$table
,
$database
=
null
)
{
$sql
=
parent
::
getListTableColumnsSQL
(
$table
,
$database
);
$parts
=
explode
(
'AS complete_type,'
,
$sql
,
2
);
return
$parts
[
0
]
.
'AS complete_type, (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,'
.
$parts
[
1
];
}
}
lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php
deleted
100644 → 0
View file @
0a18df20
<?php
namespace
Doctrine\DBAL\Platforms
;
use
Doctrine\DBAL\Types\Types
;
use
function
sprintf
;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform.
*/
class
PostgreSQL92Platform
extends
PostgreSQL91Platform
{
/**
* {@inheritdoc}
*/
public
function
getJsonTypeDeclarationSQL
(
array
$field
)
{
return
'JSON'
;
}
/**
* {@inheritdoc}
*/
public
function
getSmallIntTypeDeclarationSQL
(
array
$field
)
{
if
(
!
empty
(
$field
[
'autoincrement'
]))
{
return
'SMALLSERIAL'
;
}
return
parent
::
getSmallIntTypeDeclarationSQL
(
$field
);
}
/**
* {@inheritdoc}
*/
public
function
hasNativeJsonType
()
{
return
true
;
}
/**
* {@inheritdoc}
*/
protected
function
getReservedKeywordsClass
()
{
return
Keywords\PostgreSQL92Keywords
::
class
;
}
/**
* {@inheritdoc}
*/
protected
function
initializeDoctrineTypeMappings
()
{
parent
::
initializeDoctrineTypeMappings
();
$this
->
doctrineTypeMapping
[
'json'
]
=
Types
::
JSON
;
}
/**
* {@inheritdoc}
*/
public
function
getCloseActiveDatabaseConnectionsSQL
(
$database
)
{
return
sprintf
(
'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = %s'
,
$this
->
quoteStringLiteral
(
$database
)
);
}
}
lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php
View file @
faefe46d
...
...
@@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\Types;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4 database platform.
*/
class
PostgreSQL94Platform
extends
PostgreS
QL92
Platform
class
PostgreSQL94Platform
extends
PostgreS
ql
Platform
{
/**
* {@inheritdoc}
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
faefe46d
...
...
@@ -33,7 +33,7 @@ use function strtolower;
use
function
trim
;
/**
* P
ostgreSqlP
latform.
* P
rovides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database p
latform.
*
* @todo Rename: PostgreSQLPlatform
*/
...
...
@@ -392,6 +392,7 @@ SQL
quote_ident(a.attname) AS field,
t.typname AS type,
format_type(a.atttypid, a.atttypmod) AS complete_type,
(SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,
(SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
(SELECT format_type(t2.typbasetype, t2.typtypmod) FROM
pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type,
...
...
@@ -452,7 +453,7 @@ SQL
*/
public
function
getCloseActiveDatabaseConnectionsSQL
(
$database
)
{
return
'SELECT pg_terminate_backend(p
rocp
id) FROM pg_stat_activity WHERE datname = '
return
'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '
.
$this
->
quoteStringLiteral
(
$database
);
}
...
...
@@ -973,6 +974,10 @@ SQL
*/
public
function
getSmallIntTypeDeclarationSQL
(
array
$field
)
{
if
(
!
empty
(
$field
[
'autoincrement'
]))
{
return
'SMALLSERIAL'
;
}
return
'SMALLINT'
;
}
...
...
@@ -1161,6 +1166,7 @@ SQL
'year'
=>
'date'
,
'uuid'
=>
'guid'
,
'bytea'
=>
'blob'
,
'json'
=>
Type
::
JSON
,
];
}
...
...
@@ -1188,6 +1194,14 @@ SQL
return
0
;
}
/**
* {@inheritdoc}
*/
public
function
hasNativeJsonType
()
{
return
true
;
}
/**
* {@inheritDoc}
*/
...
...
@@ -1216,6 +1230,30 @@ SQL
return
parent
::
getDefaultValueDeclarationSQL
(
$field
);
}
/**
* {@inheritdoc}
*/
public
function
supportsColumnCollation
()
{
return
true
;
}
/**
* {@inheritdoc}
*/
public
function
getColumnCollationDeclarationSQL
(
$collation
)
{
return
'COLLATE '
.
$this
->
quoteSingleIdentifier
(
$collation
);
}
/**
* {@inheritdoc}
*/
public
function
getJsonTypeDeclarationSQL
(
array
$field
)
{
return
'JSON'
;
}
/**
* @param mixed[] $field
*/
...
...
lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
View file @
faefe46d
...
...
@@ -8,8 +8,8 @@ use Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords;
use
Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\MySQLKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\OracleKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\PostgreSQL
91
Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\PostgreSQL9
2
Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\PostgreSQL
100
Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\PostgreSQL9
4
Keywords
;
use
Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords
;
use
Doctrine\DBAL\Platforms\Keywords\ReservedKeywordsValidator
;
use
Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords
;
...
...
@@ -43,8 +43,8 @@ class ReservedWordsCommand extends Command
'sqlserver2012'
=>
SQLServer2012Keywords
::
class
,
'sqlite'
=>
SQLiteKeywords
::
class
,
'pgsql'
=>
PostgreSQLKeywords
::
class
,
'pgsql9
1'
=>
PostgreSQL91
Keywords
::
class
,
'pgsql
92'
=>
PostgreSQL92
Keywords
::
class
,
'pgsql9
4'
=>
PostgreSQL94
Keywords
::
class
,
'pgsql
100'
=>
PostgreSQL100
Keywords
::
class
,
'oracle'
=>
OracleKeywords
::
class
,
'db2'
=>
DB2Keywords
::
class
,
'sqlanywhere'
=>
SQLAnywhereKeywords
::
class
,
...
...
@@ -101,7 +101,8 @@ The following keyword lists are currently shipped with Doctrine:
* mysql57
* mysql80
* pgsql
* pgsql92
* pgsql94
* pgsql100
* sqlite
* oracle
* sqlserver
...
...
@@ -127,23 +128,7 @@ EOT
$keywordLists
=
(
array
)
$input
->
getOption
(
'list'
);
if
(
!
$keywordLists
)
{
$keywordLists
=
[
'mysql'
,
'mysql57'
,
'mysql80'
,
'pgsql'
,
'pgsql92'
,
'sqlite'
,
'oracle'
,
'sqlserver'
,
'sqlserver2005'
,
'sqlserver2008'
,
'sqlserver2012'
,
'sqlanywhere'
,
'sqlanywhere11'
,
'sqlanywhere12'
,
'sqlanywhere16'
,
];
$keywordLists
=
array_keys
(
$this
->
keywordListClasses
);
}
$keywords
=
[];
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
View file @
faefe46d
...
...
@@ -8,8 +8,6 @@ use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use
Doctrine\DBAL\Driver\ResultStatement
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\PostgreSQL100Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL91Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL92Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL94Platform
;
use
Doctrine\DBAL\Platforms\PostgreSqlPlatform
;
use
Doctrine\DBAL\Schema\AbstractSchemaManager
;
...
...
@@ -67,15 +65,9 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
protected
function
getDatabasePlatformsForVersions
()
:
array
{
return
[
[
'9.0.9'
,
PostgreSqlPlatform
::
class
],
[
'9.1'
,
PostgreSQL91Platform
::
class
],
[
'9.1.0'
,
PostgreSQL91Platform
::
class
],
[
'9.1.1'
,
PostgreSQL91Platform
::
class
],
[
'9.1.9'
,
PostgreSQL91Platform
::
class
],
[
'9.2'
,
PostgreSQL92Platform
::
class
],
[
'9.2.0'
,
PostgreSQL92Platform
::
class
],
[
'9.2.1'
,
PostgreSQL92Platform
::
class
],
[
'9.3.6'
,
PostgreSQL92Platform
::
class
],
[
'9.3'
,
PostgreSqlPlatform
::
class
],
[
'9.3.0'
,
PostgreSqlPlatform
::
class
],
[
'9.3.6'
,
PostgreSqlPlatform
::
class
],
[
'9.4'
,
PostgreSQL94Platform
::
class
],
[
'9.4.0'
,
PostgreSQL94Platform
::
class
],
[
'9.4.1'
,
PostgreSQL94Platform
::
class
],
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php
deleted
100644 → 0
View file @
0a18df20
<?php
namespace
Doctrine\Tests\DBAL\Platforms
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\PostgreSQL91Platform
;
use
Doctrine\DBAL\Schema\Table
;
class
PostgreSQL91PlatformTest
extends
PostgreSqlPlatformTest
{
public
function
createPlatform
()
:
AbstractPlatform
{
return
new
PostgreSQL91Platform
();
}
public
function
testSupportsColumnCollation
()
:
void
{
self
::
assertTrue
(
$this
->
platform
->
supportsColumnCollation
());
}
public
function
testColumnCollationDeclarationSQL
()
:
void
{
self
::
assertSame
(
'COLLATE "en_US.UTF-8"'
,
$this
->
platform
->
getColumnCollationDeclarationSQL
(
'en_US.UTF-8'
)
);
}
public
function
testGetCreateTableSQLWithColumnCollation
()
:
void
{
$table
=
new
Table
(
'foo'
);
$table
->
addColumn
(
'no_collation'
,
'string'
);
$table
->
addColumn
(
'column_collation'
,
'string'
)
->
setPlatformOption
(
'collation'
,
'en_US.UTF-8'
);
self
::
assertSame
(
[
'CREATE TABLE foo (no_collation VARCHAR(255) NOT NULL, column_collation VARCHAR(255) NOT NULL COLLATE "en_US.UTF-8")'
],
$this
->
platform
->
getCreateTableSQL
(
$table
),
'Column "no_collation" will use the default collation from the table/database and "column_collation" overwrites the collation on this column'
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php
deleted
100644 → 0
View file @
0a18df20
<?php
namespace
Doctrine\Tests\DBAL\Platforms
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\PostgreSQL92Platform
;
use
Doctrine\DBAL\Types\Types
;
class
PostgreSQL92PlatformTest
extends
AbstractPostgreSqlPlatformTestCase
{
/**
* {@inheritdoc}
*/
public
function
createPlatform
()
:
AbstractPlatform
{
return
new
PostgreSQL92Platform
();
}
/**
* @group DBAL-553
*/
public
function
testHasNativeJsonType
()
:
void
{
self
::
assertTrue
(
$this
->
platform
->
hasNativeJsonType
());
}
/**
* @group DBAL-553
*/
public
function
testReturnsJsonTypeDeclarationSQL
()
:
void
{
self
::
assertSame
(
'JSON'
,
$this
->
platform
->
getJsonTypeDeclarationSQL
([]));
}
public
function
testReturnsSmallIntTypeDeclarationSQL
()
:
void
{
self
::
assertSame
(
'SMALLSERIAL'
,
$this
->
platform
->
getSmallIntTypeDeclarationSQL
([
'autoincrement'
=>
true
])
);
self
::
assertSame
(
'SMALLINT'
,
$this
->
platform
->
getSmallIntTypeDeclarationSQL
([
'autoincrement'
=>
false
])
);
self
::
assertSame
(
'SMALLINT'
,
$this
->
platform
->
getSmallIntTypeDeclarationSQL
([])
);
}
/**
* @group DBAL-553
*/
public
function
testInitializesJsonTypeMapping
()
:
void
{
self
::
assertTrue
(
$this
->
platform
->
hasDoctrineTypeMappingFor
(
'json'
));
self
::
assertEquals
(
Types
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
}
/**
* @group DBAL-1220
*/
public
function
testReturnsCloseActiveDatabaseConnectionsSQL
()
:
void
{
self
::
assertSame
(
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'"
,
$this
->
platform
->
getCloseActiveDatabaseConnectionsSQL
(
'foo'
)
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php
View file @
faefe46d
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use
Doctrine\DBAL\Platforms\PostgreSQL94Platform
;
use
Doctrine\DBAL\Types\Types
;
class
PostgreSQL94PlatformTest
extends
PostgreS
QL92
PlatformTest
class
PostgreSQL94PlatformTest
extends
PostgreS
ql
PlatformTest
{
/**
* {@inheritdoc}
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
View file @
faefe46d
...
...
@@ -5,6 +5,7 @@ namespace Doctrine\Tests\DBAL\Platforms;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\PostgreSqlPlatform
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Types\Type
;
class
PostgreSqlPlatformTest
extends
AbstractPostgreSqlPlatformTestCase
{
...
...
@@ -32,4 +33,66 @@ class PostgreSqlPlatformTest extends AbstractPostgreSqlPlatformTestCase
'Comments are added to table.'
);
}
public
function
testColumnCollationDeclarationSQL
()
:
void
{
self
::
assertEquals
(
'COLLATE "en_US.UTF-8"'
,
$this
->
platform
->
getColumnCollationDeclarationSQL
(
'en_US.UTF-8'
)
);
}
/**
* @group DBAL-553
*/
public
function
testHasNativeJsonType
()
:
void
{
self
::
assertTrue
(
$this
->
platform
->
hasNativeJsonType
());
}
/**
* @group DBAL-553
*/
public
function
testReturnsJsonTypeDeclarationSQL
()
:
void
{
self
::
assertSame
(
'JSON'
,
$this
->
platform
->
getJsonTypeDeclarationSQL
([]));
}
public
function
testReturnsSmallIntTypeDeclarationSQL
()
:
void
{
self
::
assertSame
(
'SMALLSERIAL'
,
$this
->
platform
->
getSmallIntTypeDeclarationSQL
([
'autoincrement'
=>
true
])
);
self
::
assertSame
(
'SMALLINT'
,
$this
->
platform
->
getSmallIntTypeDeclarationSQL
([
'autoincrement'
=>
false
])
);
self
::
assertSame
(
'SMALLINT'
,
$this
->
platform
->
getSmallIntTypeDeclarationSQL
([])
);
}
/**
* @group DBAL-553
*/
public
function
testInitializesJsonTypeMapping
()
:
void
{
self
::
assertTrue
(
$this
->
platform
->
hasDoctrineTypeMappingFor
(
'json'
));
self
::
assertEquals
(
Type
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
}
/**
* @group DBAL-1220
*/
public
function
testReturnsCloseActiveDatabaseConnectionsSQL
()
:
void
{
self
::
assertSame
(
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'"
,
$this
->
platform
->
getCloseActiveDatabaseConnectionsSQL
(
'foo'
)
);
}
}
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