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
d40226cc
Commit
d40226cc
authored
Jan 09, 2016
by
Steve Müller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #925 from tornellas/master
Fixing the command when option is CURRENT_SCHEMA
parents
db358c83
5b641039
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
OracleSessionInit.php
lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
+5
-1
OracleSessionInitTest.php
tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php
+29
-1
No files found.
lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
View file @
d40226cc
...
...
@@ -69,7 +69,11 @@ class OracleSessionInit implements EventSubscriber
array_change_key_case
(
$this
->
_defaultSessionVars
,
\CASE_UPPER
);
$vars
=
array
();
foreach
(
$this
->
_defaultSessionVars
as
$option
=>
$value
)
{
$vars
[]
=
$option
.
" = '"
.
$value
.
"'"
;
if
(
$option
===
'CURRENT_SCHEMA'
)
{
$vars
[]
=
$option
.
" = "
.
$value
;
}
else
{
$vars
[]
=
$option
.
" = '"
.
$value
.
"'"
;
}
}
$sql
=
"ALTER SESSION SET "
.
implode
(
" "
,
$vars
);
$args
->
getConnection
()
->
executeUpdate
(
$sql
);
...
...
tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php
View file @
d40226cc
...
...
@@ -23,9 +23,37 @@ class OracleSessionInitTest extends DbalTestCase
$listener
->
postConnect
(
$eventArgs
);
}
/**
* @group DBAL-1824
*
* @dataProvider getPostConnectWithSessionParameterValuesData
*/
public
function
testPostConnectQuotesSessionParameterValues
(
$name
,
$value
)
{
$connectionMock
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Connection'
)
->
disableOriginalConstructor
()
->
getMock
();
$connectionMock
->
expects
(
$this
->
once
())
->
method
(
'executeUpdate'
)
->
with
(
$this
->
stringContains
(
sprintf
(
'%s = %s'
,
$name
,
$value
)));
$eventArgs
=
new
ConnectionEventArgs
(
$connectionMock
);
$listener
=
new
OracleSessionInit
(
array
(
$name
=>
$value
));
$listener
->
postConnect
(
$eventArgs
);
}
public
function
getPostConnectWithSessionParameterValuesData
()
{
return
array
(
array
(
'CURRENT_SCHEMA'
,
'foo'
),
);
}
public
function
testGetSubscribedEvents
()
{
$listener
=
new
OracleSessionInit
();
$this
->
assertEquals
(
array
(
Events
::
postConnect
),
$listener
->
getSubscribedEvents
());
}
}
\ No newline at end of file
}
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