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
03ea4779
Commit
03ea4779
authored
Aug 30, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DBAL-160' into 2.1.x
parents
e56f90aa
b2eb7d1f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletion
+71
-1
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+1
-1
OCI8StatementTest.php
tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
+70
-0
No files found.
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
03ea4779
...
...
@@ -156,7 +156,7 @@ class OCI8Statement implements \Doctrine\DBAL\Driver\Statement
public
function
execute
(
$params
=
null
)
{
if
(
$params
)
{
$hasZeroIndex
=
isset
(
$params
[
0
]
);
$hasZeroIndex
=
array_key_exists
(
0
,
$params
);
foreach
(
$params
as
$key
=>
$val
)
{
if
(
$hasZeroIndex
&&
is_numeric
(
$key
))
{
$this
->
bindValue
(
$key
+
1
,
$val
);
...
...
tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
0 → 100644
View file @
03ea4779
<?php
namespace
Doctrine\Tests\DBAL
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
OCI8StatementTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
function
getMockOCI8Statement
()
{
$dbh
=
null
;
$statement
=
"update table set field1 = ?, field2 = ? where field3 = ?"
;
$executeMode
=
OCI_COMMIT_ON_SUCCESS
;
return
$this
->
getMock
(
'\Doctrine\DBAL\Driver\OCI8\OCI8Statement'
,
array
(
'bindValue'
,
'errorInfo'
),
array
(
null
,
$statement
,
$executeMode
),
''
,
false
);
}
/**
* This scenario shows that when the first parameter is not null
* it properly sets $hasZeroIndex to 1 and calls bindValue starting at 1.
*
* The expected exception is due to oci_execute failing due to no valid connection.
*
* @dataProvider executeDataProvider
* @expectedException \Doctrine\DBAL\Driver\OCI8\OCI8Exception
*/
public
function
testExecute
(
array
$params
)
{
$statement
=
$this
->
getMockOCI8Statement
();
$statement
->
expects
(
$this
->
at
(
0
))
->
method
(
'bindValue'
)
->
with
(
$this
->
equalTo
(
1
),
$this
->
equalTo
(
$params
[
0
])
);
$statement
->
expects
(
$this
->
at
(
1
))
->
method
(
'bindValue'
)
->
with
(
$this
->
equalTo
(
2
),
$this
->
equalTo
(
$params
[
1
])
);
$statement
->
expects
(
$this
->
at
(
2
))
->
method
(
'bindValue'
)
->
with
(
$this
->
equalTo
(
3
),
$this
->
equalTo
(
$params
[
2
])
);
$statement
->
execute
(
$params
);
}
public
static
function
executeDataProvider
()
{
return
array
(
// $hasZeroIndex = isset($params[0]); == true
array
(
array
(
0
=>
'test'
,
1
=>
null
,
2
=>
'value'
)
),
// $hasZeroIndex = isset($params[0]); == false
array
(
array
(
0
=>
null
,
1
=>
'test'
,
2
=>
'value'
)
)
);
}
}
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