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
f97b3e19
Unverified
Commit
f97b3e19
authored
Jun 10, 2019
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of the call to Connection::getParams() in Portability\Statement
parent
e33c76a6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
14 deletions
+39
-14
Connection.php
src/Portability/Connection.php
+39
-14
No files found.
src/Portability/Connection.php
View file @
f97b3e19
...
...
@@ -2,9 +2,13 @@
namespace
Doctrine\DBAL\Portability
;
use
Doctrine\Common\EventManager
;
use
Doctrine\DBAL\Abstraction\Result
as
AbstractionResult
;
use
Doctrine\DBAL\Cache\QueryCacheProfile
;
use
Doctrine\DBAL\ColumnCase
;
use
Doctrine\DBAL\Configuration
;
use
Doctrine\DBAL\Connection
as
BaseConnection
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Driver\PDOConnection
;
use
Doctrine\DBAL\Driver\Result
as
DriverResult
;
use
Doctrine\DBAL\Driver\Statement
as
DriverStatement
;
...
...
@@ -17,7 +21,7 @@ use const CASE_UPPER;
/**
* Portability wrapper for a Connection.
*/
class
Connection
extends
\Doctrine\DBAL\
Connection
class
Connection
extends
Base
Connection
{
public
const
PORTABILITY_ALL
=
255
;
public
const
PORTABILITY_NONE
=
0
;
...
...
@@ -25,9 +29,35 @@ class Connection extends \Doctrine\DBAL\Connection
public
const
PORTABILITY_EMPTY_TO_NULL
=
4
;
public
const
PORTABILITY_FIX_CASE
=
8
;
/** @var int */
private
$portability
=
self
::
PORTABILITY_NONE
;
/** @var int */
private
$case
=
0
;
/** @var Converter */
private
$converter
;
/** {@inheritDoc} */
public
function
__construct
(
array
$params
,
Driver
$driver
,
?
Configuration
$config
=
null
,
?
EventManager
$eventManager
=
null
)
{
if
(
isset
(
$params
[
'portability'
]))
{
$this
->
portability
=
$params
[
'portability'
];
}
if
(
isset
(
$params
[
'fetch_case'
]))
{
$this
->
case
=
$params
[
'fetch_case'
];
}
unset
(
$params
[
'portability'
],
$params
[
'fetch_case'
]);
parent
::
__construct
(
$params
,
$driver
,
$config
,
$eventManager
);
}
/**
* {@inheritdoc}
*/
...
...
@@ -35,24 +65,19 @@ class Connection extends \Doctrine\DBAL\Connection
{
$ret
=
parent
::
connect
();
if
(
$ret
)
{
$params
=
$this
->
getParams
();
$portability
=
self
::
PORTABILITY_NONE
;
if
(
isset
(
$params
[
'portability'
]))
{
$portability
=
$params
[
'portability'
]
=
(
new
OptimizeFlags
())(
$portability
=
(
new
OptimizeFlags
())(
$this
->
getDatabasePlatform
(),
$params
[
'portability'
]
$this
->
portability
);
}
$case
=
null
;
$case
=
0
;
if
(
isset
(
$params
[
'fetch_case'
])
&&
(
$portability
&
self
::
PORTABILITY_FIX_CASE
)
!==
0
)
{
if
(
$this
->
case
!==
0
&&
(
$portability
&
self
::
PORTABILITY_FIX_CASE
)
!==
0
)
{
if
(
$this
->
_conn
instanceof
PDOConnection
)
{
// make use of c-level support for case handling
$this
->
_conn
->
getWrappedConnection
()
->
setAttribute
(
PDO
::
ATTR_CASE
,
$
params
[
'fetch_case'
]
);
$this
->
_conn
->
getWrappedConnection
()
->
setAttribute
(
PDO
::
ATTR_CASE
,
$
this
->
case
);
}
else
{
$case
=
$
params
[
'fetch_case'
]
===
ColumnCase
::
LOWER
?
CASE_LOWER
:
CASE_UPPER
;
$case
=
$
this
->
case
===
ColumnCase
::
LOWER
?
CASE_LOWER
:
CASE_UPPER
;
}
}
...
...
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