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
400f6044
Unverified
Commit
400f6044
authored
Dec 21, 2019
by
Sergei Morozov
Committed by
GitHub
Dec 21, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3738 from ModelTech/hotfix/oci8_named_paramters
Fix breaks named parameters in Oracle
parents
39b76b4b
9f4d9a5b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
5 deletions
+35
-5
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+10
-4
StatementTest.php
...trine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php
+25
-1
No files found.
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
400f6044
...
@@ -276,9 +276,15 @@ class OCI8Statement implements IteratorAggregate, Statement
...
@@ -276,9 +276,15 @@ class OCI8Statement implements IteratorAggregate, Statement
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
bindParam
(
$
column
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
public
function
bindParam
(
$
param
,
&
$variable
,
$type
=
ParameterType
::
STRING
,
$length
=
null
)
{
{
$column
=
$this
->
_paramMap
[
$column
];
if
(
is_int
(
$param
))
{
if
(
!
isset
(
$this
->
_paramMap
[
$param
]))
{
throw
new
OCI8Exception
(
sprintf
(
'Could not find variable mapping with index %d, in the SQL statement'
,
$param
));
}
$param
=
$this
->
_paramMap
[
$param
];
}
if
(
$type
===
ParameterType
::
LARGE_OBJECT
)
{
if
(
$type
===
ParameterType
::
LARGE_OBJECT
)
{
$lob
=
oci_new_descriptor
(
$this
->
_dbh
,
OCI_D_LOB
);
$lob
=
oci_new_descriptor
(
$this
->
_dbh
,
OCI_D_LOB
);
...
@@ -291,11 +297,11 @@ class OCI8Statement implements IteratorAggregate, Statement
...
@@ -291,11 +297,11 @@ class OCI8Statement implements IteratorAggregate, Statement
$variable
=&
$lob
;
$variable
=&
$lob
;
}
}
$this
->
boundValues
[
$
column
]
=&
$variable
;
$this
->
boundValues
[
$
param
]
=&
$variable
;
return
oci_bind_by_name
(
return
oci_bind_by_name
(
$this
->
_sth
,
$this
->
_sth
,
$
column
,
$
param
,
$variable
,
$variable
,
$length
??
-
1
,
$length
??
-
1
,
$this
->
convertParameterType
(
$type
)
$this
->
convertParameterType
(
$type
)
...
...
tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php
View file @
400f6044
...
@@ -37,17 +37,41 @@ class StatementTest extends DbalFunctionalTestCase
...
@@ -37,17 +37,41 @@ class StatementTest extends DbalFunctionalTestCase
);
);
}
}
/**
* Low-level approach to working with parameter binding
*
* @param mixed[] $params
* @param mixed[] $expected
*
* @dataProvider queryConversionProvider
*/
public
function
testStatementBindParameters
(
string
$query
,
array
$params
,
array
$expected
)
:
void
{
$stmt
=
$this
->
connection
->
prepare
(
$query
);
$stmt
->
execute
(
$params
);
self
::
assertEquals
(
$expected
,
$stmt
->
fetch
()
);
}
/**
/**
* @return array<string, array<int, mixed>>
* @return array<string, array<int, mixed>>
*/
*/
public
static
function
queryConversionProvider
()
:
iterable
public
static
function
queryConversionProvider
()
:
iterable
{
{
return
[
return
[
'
simple
'
=>
[
'
positional
'
=>
[
'SELECT ? COL1 FROM DUAL'
,
'SELECT ? COL1 FROM DUAL'
,
[
1
],
[
1
],
[
'COL1'
=>
1
],
[
'COL1'
=>
1
],
],
],
'named'
=>
[
'SELECT :COL COL1 FROM DUAL'
,
[
':COL'
=>
1
],
[
'COL1'
=>
1
],
],
'literal-with-placeholder'
=>
[
'literal-with-placeholder'
=>
[
"SELECT '?' COL1, ? COL2 FROM DUAL"
,
"SELECT '?' COL1, ? COL2 FROM DUAL"
,
[
2
],
[
2
],
...
...
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