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
b37a5cce
Commit
b37a5cce
authored
Jul 09, 2016
by
Christopher Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track the Values & Types Passed to Statement::bindParam
So they get passed to the SQLLogger on `Statement::execute`.
parent
69b57859
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
Statement.php
lib/Doctrine/DBAL/Statement.php
+2
-0
StatementTest.php
tests/Doctrine/Tests/DBAL/StatementTest.php
+22
-0
No files found.
lib/Doctrine/DBAL/Statement.php
View file @
b37a5cce
...
...
@@ -138,6 +138,8 @@ class Statement implements \IteratorAggregate, DriverStatement
*/
public
function
bindParam
(
$name
,
&
$var
,
$type
=
PDO
::
PARAM_STR
,
$length
=
null
)
{
$this
->
params
[
$name
]
=
$var
;
$this
->
types
[
$name
]
=
$type
;
return
$this
->
stmt
->
bindParam
(
$name
,
$var
,
$type
,
$length
);
}
...
...
tests/Doctrine/Tests/DBAL/StatementTest.php
View file @
b37a5cce
...
...
@@ -103,6 +103,28 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$statement
->
execute
(
$values
);
}
public
function
testExecuteCallsStartQueryWithTheParametersBoundViaBindParam
()
{
$name
=
'foo'
;
$var
=
'bar'
;
$values
=
array
(
$name
=>
$var
);
$types
=
array
(
$name
=>
\PDO
::
PARAM_STR
);
$sql
=
''
;
$logger
=
$this
->
createMock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$logger
->
expects
(
$this
->
once
())
->
method
(
'startQuery'
)
->
with
(
$this
->
equalTo
(
$sql
),
$this
->
equalTo
(
$values
),
$this
->
equalTo
(
$types
));
$this
->
configuration
->
expects
(
$this
->
once
())
->
method
(
'getSQLLogger'
)
->
will
(
$this
->
returnValue
(
$logger
));
$statement
=
new
Statement
(
$sql
,
$this
->
conn
);
$statement
->
bindParam
(
$name
,
$var
);
$statement
->
execute
();
}
/**
* @expectedException \Doctrine\DBAL\DBALException
*/
...
...
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