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
d68603c4
Commit
d68603c4
authored
Feb 12, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add automatic platform version detection for PostgreSQL 9.1
parent
f43bebc7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
AbstractPostgreSQLDriver.php
lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
+8
-4
AbstractPostgreSQLDriverTest.php
...ctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
+5
-1
No files found.
lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
View file @
d68603c4
...
...
@@ -22,6 +22,7 @@ namespace Doctrine\DBAL\Driver;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Exception
;
use
Doctrine\DBAL\Platforms\PostgreSQL91Platform
;
use
Doctrine\DBAL\Platforms\PostgreSQL92Platform
;
use
Doctrine\DBAL\Platforms\PostgreSqlPlatform
;
use
Doctrine\DBAL\Schema\PostgreSqlSchemaManager
;
...
...
@@ -98,11 +99,14 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri
$patchVersion
=
isset
(
$versionParts
[
'patch'
])
?
$versionParts
[
'patch'
]
:
0
;
$version
=
$majorVersion
.
'.'
.
$minorVersion
.
'.'
.
$patchVersion
;
if
(
version_compare
(
$version
,
'9.2'
,
'>='
))
{
switch
(
true
)
{
case
version_compare
(
$version
,
'9.2'
,
'>='
)
:
return
new
PostgreSQL92Platform
();
case
version_compare
(
$version
,
'9.1'
,
'>='
)
:
return
new
PostgreSQL91Platform
();
default
:
return
new
PostgreSqlPlatform
();
}
return
$this
->
getDatabasePlatform
();
}
/**
...
...
tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
View file @
d68603c4
...
...
@@ -55,7 +55,11 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
protected
function
getDatabasePlatformsForVersions
()
{
return
array
(
array
(
'9.1.9'
,
'Doctrine\DBAL\Platforms\PostgreSqlPlatform'
),
array
(
'9.0.9'
,
'Doctrine\DBAL\Platforms\PostgreSqlPlatform'
),
array
(
'9.1'
,
'Doctrine\DBAL\Platforms\PostgreSQL91Platform'
),
array
(
'9.1.0'
,
'Doctrine\DBAL\Platforms\PostgreSQL91Platform'
),
array
(
'9.1.1'
,
'Doctrine\DBAL\Platforms\PostgreSQL91Platform'
),
array
(
'9.1.9'
,
'Doctrine\DBAL\Platforms\PostgreSQL91Platform'
),
array
(
'9.2'
,
'Doctrine\DBAL\Platforms\PostgreSQL92Platform'
),
array
(
'9.2.0'
,
'Doctrine\DBAL\Platforms\PostgreSQL92Platform'
),
array
(
'9.2.1'
,
'Doctrine\DBAL\Platforms\PostgreSQL92Platform'
),
...
...
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