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
c2a4ae07
Unverified
Commit
c2a4ae07
authored
Dec 25, 2017
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced PDO::CASE_* constants
parent
1d09430f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
portability.rst
docs/en/reference/portability.rst
+8
-4
Connection.php
lib/Doctrine/DBAL/Portability/Connection.php
+3
-1
PortabilityTest.php
tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
+10
-5
No files found.
docs/en/reference/portability.rst
View file @
c2a4ae07
...
...
@@ -51,12 +51,16 @@ Using the following code block in your initialization will:
.. code-block:: php
<?php
use Doctrine\DBAL\ColumnCase;
use Doctrine\DBAL\Portability\Connection as PortableConnection;
$params = array(
// vendor specific configuration
//...
'wrapperClass' =>
'Doctrine\DBAL\Portability\Connection'
,
'portability'
=> \Doctrine\DBAL\Portability\
Connection::PORTABILITY_ALL,
'fetch_case'
=> \PDO::CASE_
LOWER,
'wrapperClass' =>
PortableConnection::class
,
'portability'
=> Portable
Connection::PORTABILITY_ALL,
'fetch_case'
=> PortableConnection::
LOWER,
);
This sort of portability handling is pretty expensive because all the result
...
...
@@ -80,4 +84,4 @@ This functionality is only implemented with Doctrine 2.1 upwards.
Doctrine ships with lists of keywords for every supported vendor. You
can access a keyword list through the schema manager of the vendor you
are currently using or just instantiating it from the ``Doctrine\DBAL\Platforms\Keywords``
namespace.
\ No newline at end of file
namespace.
lib/Doctrine/DBAL/Portability/Connection.php
View file @
c2a4ae07
...
...
@@ -20,6 +20,7 @@
namespace
Doctrine\DBAL\Portability
;
use
Doctrine\DBAL\Cache\QueryCacheProfile
;
use
Doctrine\DBAL\ColumnCase
;
/**
* Portability wrapper for a Connection.
...
...
@@ -83,12 +84,13 @@ class Connection extends \Doctrine\DBAL\Connection
}
$this
->
portability
=
$params
[
'portability'
];
}
if
(
isset
(
$params
[
'fetch_case'
])
&&
$this
->
portability
&
self
::
PORTABILITY_FIX_CASE
)
{
if
(
$this
->
_conn
instanceof
\Doctrine\DBAL\Driver\PDOConnection
)
{
// make use of c-level support for case handling
$this
->
_conn
->
setAttribute
(
\PDO
::
ATTR_CASE
,
$params
[
'fetch_case'
]);
}
else
{
$this
->
case
=
(
$params
[
'fetch_case'
]
==
\PDO
::
CASE_
LOWER
)
?
CASE_LOWER
:
CASE_UPPER
;
$this
->
case
=
(
$params
[
'fetch_case'
]
==
ColumnCase
::
LOWER
)
?
CASE_LOWER
:
CASE_UPPER
;
}
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
View file @
c2a4ae07
...
...
@@ -2,6 +2,7 @@
namespace
Doctrine\Tests\DBAL\Functional
;
use
Doctrine\DBAL\ColumnCase
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\DriverManager
;
use
Doctrine\DBAL\FetchMode
;
...
...
@@ -28,13 +29,17 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
* @param int $case
* @return Connection
*/
private
function
getPortableConnection
(
$portabilityMode
=
\Doctrine\DBAL\Portability\Connection
::
PORTABILITY_ALL
,
$case
=
\PDO
::
CASE_LOWER
)
{
private
function
getPortableConnection
(
$portabilityMode
=
ConnectionPortability
::
PORTABILITY_ALL
,
$case
=
ColumnCase
::
LOWER
)
{
if
(
!
$this
->
portableConnection
)
{
$params
=
$this
->
_conn
->
getParams
();
$params
[
'wrapperClass'
]
=
'Doctrine\DBAL\Portability\Connection'
;
$params
[
'portability'
]
=
$portabilityMode
;
$params
[
'fetch_case'
]
=
$case
;
$params
[
'wrapperClass'
]
=
ConnectionPortability
::
class
;
$params
[
'portability'
]
=
$portabilityMode
;
$params
[
'fetch_case'
]
=
$case
;
$this
->
portableConnection
=
DriverManager
::
getConnection
(
$params
,
$this
->
_conn
->
getConfiguration
(),
$this
->
_conn
->
getEventManager
());
try
{
...
...
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